aboutsummaryrefslogtreecommitdiff
path: root/node_modules/acorn/dist/acorn_loose.es.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/acorn/dist/acorn_loose.es.js')
-rw-r--r--node_modules/acorn/dist/acorn_loose.es.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/node_modules/acorn/dist/acorn_loose.es.js b/node_modules/acorn/dist/acorn_loose.es.js
index 449afc889..469f73a2f 100644
--- a/node_modules/acorn/dist/acorn_loose.es.js
+++ b/node_modules/acorn/dist/acorn_loose.es.js
@@ -300,6 +300,7 @@ lp$1.parseTopLevel = function() {
var node = this.startNodeAt(this.options.locations ? [0, getLineInfo(this.input, 0)] : 0);
node.body = [];
while (this.tok.type !== tokTypes.eof) { node.body.push(this$1.parseStatement()); }
+ this.toks.adaptDirectivePrologue(node.body);
this.last = this.tok;
if (this.options.ecmaVersion >= 6) {
node.sourceType = this.options.sourceType;
@@ -630,6 +631,7 @@ lp$1.parseFunction = function(node, isStatement, isAsync) {
this.inAsync = node.async;
node.params = this.parseFunctionParams();
node.body = this.parseBlock();
+ this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync;
return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression")
};
@@ -676,7 +678,6 @@ lp$1.parseImport = function() {
if (this.tok.type === tokTypes.string) {
node.specifiers = [];
node.source = this.parseExprAtom();
- node.kind = "";
} else {
var elt;
if (this.tok.type === tokTypes.name && this.tok.value !== "from") {
@@ -1150,7 +1151,7 @@ lp$2.parseObj = function() {
prop.value = this$1.parseMethod(isGenerator, isAsync);
} else if (this$1.options.ecmaVersion >= 5 && prop.key.type === "Identifier" &&
!prop.computed && (prop.key.name === "get" || prop.key.name === "set") &&
- (this$1.tok.type != tokTypes.comma && this$1.tok.type != tokTypes.braceR)) {
+ (this$1.tok.type != tokTypes.comma && this$1.tok.type != tokTypes.braceR && this$1.tok.type != tokTypes.eq)) {
prop.kind = prop.key.name;
this$1.parsePropertyName(prop);
prop.value = this$1.parseMethod(false);
@@ -1285,8 +1286,8 @@ lp$2.parseMethod = function(isGenerator, isAsync) {
{ node.async = !!isAsync; }
this.inAsync = node.async;
node.params = this.parseFunctionParams();
- node.expression = this.options.ecmaVersion >= 6 && this.tok.type !== tokTypes.braceL;
- node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
+ node.body = this.parseBlock();
+ this.toks.adaptDirectivePrologue(node.body.body);
this.inAsync = oldInAsync;
return this.finishNode(node, "FunctionExpression")
};
@@ -1299,7 +1300,12 @@ lp$2.parseArrowExpression = function(node, params, isAsync) {
this.inAsync = node.async;
node.params = this.toAssignableList(params, true);
node.expression = this.tok.type !== tokTypes.braceL;
- node.body = node.expression ? this.parseMaybeAssign() : this.parseBlock();
+ if (node.expression) {
+ node.body = this.parseMaybeAssign();
+ } else {
+ node.body = this.parseBlock();
+ this.toks.adaptDirectivePrologue(node.body.body);
+ }
this.inAsync = oldInAsync;
return this.finishNode(node, "ArrowFunctionExpression")
};