fix: don't fail if definition is undefined

Running `uglifyjs --verbose --compress --mangle --screw-ie8 class.js`
with
`class.js`:
```
class Foo {
  bar() {
  }
}
```
Fails with:
```
undefined:4041
  return this.definition().unmangleable(options);
TypeError: Cannot read property 'unmangleable' of undefined
...
```
This commit is contained in:
Darío Javier Cravero
2016-02-04 21:54:21 +00:00
committed by Richard van Velzen
parent d7ec2ecc12
commit 0b303379c0

View File

@@ -350,7 +350,8 @@ AST_Scope.DEFMETHOD("references", function(sym){
});
AST_Symbol.DEFMETHOD("unmangleable", function(options){
return this.definition().unmangleable(options);
var def = this.definition();
return def && def.unmangleable(options);
});
// property accessors are not mangleable