From a787a302236d89d6c4e24ecdbd63845abd263c3e Mon Sep 17 00:00:00 2001 From: Alex Rattray Date: Tue, 20 Dec 2016 03:16:46 -0800 Subject: [PATCH] Allow this.state.clone() when parsing decorators Adding the line `this.state = this.state.clone();` in a parser plugin (specifically, in my case `parseExprAtom`) would break decorators. This change fixes that. --- src/parser/statement.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/parser/statement.js b/src/parser/statement.js index d2dfce09e2..40bcb56882 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -149,7 +149,8 @@ pp.takeDecorators = function (node) { pp.parseDecorators = function (allowExport) { while (this.match(tt.at)) { - this.state.decorators.push(this.parseDecorator()); + let decorator = this.parseDecorator(); + this.state.decorators.push(decorator); } if (allowExport && this.match(tt._export)) {