Verify if MemberExpression is computed

If a property access is computed, e.g. a[b], then it's in topic style. Currently,
this isn't accounted for. Test & change ensures this doesn't parse.
This commit is contained in:
James DiGioia
2018-08-10 08:06:38 -04:00
parent 25d01460fd
commit 122906d525
5 changed files with 7 additions and 152 deletions

View File

@@ -2100,7 +2100,9 @@ export default class ExpressionParser extends LValParser {
isSimpleReference(expression: N.Expression): boolean {
switch (expression.type) {
case "MemberExpression":
return this.isSimpleReference(expression.object);
return (
!expression.computed && this.isSimpleReference(expression.object)
);
case "Identifier":
return true;
default: