Skip to content

Commit

Permalink
Verify if MemberExpression is computed
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mAAdhaTTah committed Aug 10, 2018
1 parent 25d0146 commit 122906d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 152 deletions.
4 changes: 3 additions & 1 deletion packages/babel-parser/src/parser/expression.js
Expand Up @@ -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:
Expand Down

This file was deleted.

This file was deleted.

@@ -0,0 +1,4 @@
{
"plugins": [["pipelineOperator", { "proposal": "smart" }]],
"throws": "Pipeline is in topic style but does not use topic reference (1:9)"
}

0 comments on commit 122906d

Please sign in to comment.