Support unary expression in isPure check

This commit is contained in:
Amjad Masad 2015-12-07 11:55:21 -08:00
parent b8f5ca4ff0
commit 6601a6f737

View File

@ -596,6 +596,8 @@ export default class Scope {
} else if (t.isClassProperty(node)) {
if (node.computed && !this.isPure(node.key, constantsOnly)) return false;
return this.isPure(node.value, constantsOnly);
} else if (t.isUnaryExpression(node)) {
return this.isPure(node.argument);
} else {
return t.isPureish(node);
}