diff --git a/javascript/extractor/src/com/semmle/jcorn/ESNextParser.java b/javascript/extractor/src/com/semmle/jcorn/ESNextParser.java index a11293ca05f..df6eec3df8f 100644 --- a/javascript/extractor/src/com/semmle/jcorn/ESNextParser.java +++ b/javascript/extractor/src/com/semmle/jcorn/ESNextParser.java @@ -257,7 +257,7 @@ public class ESNextParser extends JSXParser { return member; } - private List parseDecorators() { + public List parseDecorators() { List result = new ArrayList(); while (this.type == at) result.add(this.parseDecorator()); @@ -267,10 +267,23 @@ public class ESNextParser extends JSXParser { private Decorator parseDecorator() { Position start = startLoc; this.next(); - Decorator decorator = new Decorator(new SourceLocation(start), this.parseMaybeAssign(false, null, null)); + Expression body = parseDecoratorBody(); + Decorator decorator = new Decorator(new SourceLocation(start), body); return this.finishNode(decorator); } + protected Expression parseDecoratorBody() { + Expression base; + int startPos = this.start; + Position startLoc = this.startLoc; + if (this.type == TokenType.parenL) { + base = parseParenExpression(); + } else { + base = parseIdent(true); + } + return parseSubscripts(base, startPos, startLoc, false); + } + /* * Support for proposed extensions to `export` * (http://leebyron.com/ecmascript-export-ns-from and http://leebyron.com/ecmascript-export-default-from)