Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
parse parameter decorators
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhei committed Mar 10, 2016
1 parent 240953f commit 23ff430
Show file tree
Hide file tree
Showing 4 changed files with 401 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/parser/lval.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,14 @@ pp.parseBindingList = function (close, allowEmpty, allowTrailingComma) {
this.expect(close);
break;
} else {
let decorators = [];
while (this.match(tt.at)) {
decorators.push(this.parseDecorator());
}
let left = this.parseMaybeDefault();
if (decorators.length) {
left.decorators = decorators;
}
this.parseAssignableListItemTypes(left);
elts.push(this.parseMaybeDefault(null, null, left));
}
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/experimental/decorators/options.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"plugins": ["decorators"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Foo {
constructor(@foo() x, @bar({ a: 123 }) @baz() y) {}
}
Loading

0 comments on commit 23ff430

Please sign in to comment.