deps: update acorn to 6.1.0

PR-URL: https://github.com/nodejs/node/pull/26102
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
gengjiawen 2019-02-14 22:45:55 +08:00 committed by Daniel Bevenius
parent a1a01d3f27
commit 64a15811c8
7 changed files with 113 additions and 91 deletions

View File

@ -1,3 +1,13 @@
## 6.1.0 (2019-02-08)
### Bug fixes
Fix scope checking when redefining a `var` as a lexical binding.
### New features
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
## 6.0.7 (2019-02-04) ## 6.0.7 (2019-02-04)
### Bug fixes ### Bug fixes

0
deps/acorn/acorn/bin/acorn vendored Executable file → Normal file
View File

View File

@ -607,7 +607,7 @@ pp.strictDirective = function(start) {
// Skip semicolon, if any. // Skip semicolon, if any.
skipWhiteSpace.lastIndex = start; skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this$1.input)[0].length; start += skipWhiteSpace.exec(this$1.input)[0].length;
if (this$1.input[start] === ';') if (this$1.input[start] === ";")
{ start++; } { start++; }
} }
}; };
@ -2139,47 +2139,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async"; this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
for (var computed = (void 0);;) { while (true) {
if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) { var element = this$1.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
var node = this$1.startNodeAt(startPos, startLoc); if (element === base || element.type === "ArrowFunctionExpression") { return element }
node.object = base; base = element;
node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true);
node.computed = !!computed;
if (computed) { this$1.expect(types.bracketR); }
base = this$1.finishNode(node, "MemberExpression");
} else if (!noCalls && this$1.eat(types.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos, oldAwaitIdentPos = this$1.awaitIdentPos;
this$1.yieldPos = 0;
this$1.awaitPos = 0;
this$1.awaitIdentPos = 0;
var exprList = this$1.parseExprList(types.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(types.arrow)) {
this$1.checkPatternErrors(refDestructuringErrors, false);
this$1.checkYieldAwaitInDefaultParams();
if (this$1.awaitIdentPos > 0)
{ this$1.raise(this$1.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
this$1.yieldPos = oldYieldPos;
this$1.awaitPos = oldAwaitPos;
this$1.awaitIdentPos = oldAwaitIdentPos;
return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)
} }
this$1.checkExpressionErrors(refDestructuringErrors, true); };
this$1.yieldPos = oldYieldPos || this$1.yieldPos;
this$1.awaitPos = oldAwaitPos || this$1.awaitPos; pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
this$1.awaitIdentPos = oldAwaitIdentPos || this$1.awaitIdentPos; var computed = this.eat(types.bracketL);
var node$1 = this$1.startNodeAt(startPos, startLoc); if (computed || this.eat(types.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = computed ? this.parseExpression() : this.parseIdent(true);
node.computed = !!computed;
if (computed) { this.expect(types.bracketR); }
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(types.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0)
{ this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.callee = base; node$1.callee = base;
node$1.arguments = exprList; node$1.arguments = exprList;
base = this$1.finishNode(node$1, "CallExpression"); base = this.finishNode(node$1, "CallExpression");
} else if (this$1.type === types.backQuote) { } else if (this.type === types.backQuote) {
var node$2 = this$1.startNodeAt(startPos, startLoc); var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base; node$2.tag = base;
node$2.quasi = this$1.parseTemplate({isTagged: true}); node$2.quasi = this.parseTemplate({isTagged: true});
base = this$1.finishNode(node$2, "TaggedTemplateExpression"); base = this.finishNode(node$2, "TaggedTemplateExpression");
} else { }
return base return base
}
}
}; };
// Parse an atomic expression — either a single token that is an // Parse an atomic expression — either a single token that is an
@ -2874,7 +2880,7 @@ pp$5.exitScope = function() {
// > At the top level of a function, or script, function declarations are // > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations. // > treated like var declarations rather than like lexical declarations.
pp$5.treatFunctionsAsVarInScope = function(scope) { pp$5.treatFunctionsAsVarInScope = function(scope) {
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP); return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
}; };
pp$5.declareName = function(name, bindingType, pos) { pp$5.declareName = function(name, bindingType, pos) {
@ -2900,7 +2906,7 @@ pp$5.declareName = function(name, bindingType, pos) {
} else { } else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) { for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var scope$3 = this$1.scopeStack[i]; var scope$3 = this$1.scopeStack[i];
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name || if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
!this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { !this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
redeclared = true; redeclared = true;
break break
@ -4955,7 +4961,7 @@ pp$8.readWord = function() {
// //
// [walk]: util/walk.js // [walk]: util/walk.js
var version = "6.0.7"; var version = "6.1.0";
// The main exported interface (under `self.acorn` when in the // The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and // browser) is a `parse` function that takes a code string and

File diff suppressed because one or more lines are too long

View File

@ -601,7 +601,7 @@ pp.strictDirective = function(start) {
// Skip semicolon, if any. // Skip semicolon, if any.
skipWhiteSpace.lastIndex = start; skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this$1.input)[0].length; start += skipWhiteSpace.exec(this$1.input)[0].length;
if (this$1.input[start] === ';') if (this$1.input[start] === ";")
{ start++; } { start++; }
} }
}; };
@ -2133,47 +2133,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async"; this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
for (var computed = (void 0);;) { while (true) {
if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) { var element = this$1.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
var node = this$1.startNodeAt(startPos, startLoc); if (element === base || element.type === "ArrowFunctionExpression") { return element }
node.object = base; base = element;
node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true);
node.computed = !!computed;
if (computed) { this$1.expect(types.bracketR); }
base = this$1.finishNode(node, "MemberExpression");
} else if (!noCalls && this$1.eat(types.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos, oldAwaitIdentPos = this$1.awaitIdentPos;
this$1.yieldPos = 0;
this$1.awaitPos = 0;
this$1.awaitIdentPos = 0;
var exprList = this$1.parseExprList(types.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(types.arrow)) {
this$1.checkPatternErrors(refDestructuringErrors, false);
this$1.checkYieldAwaitInDefaultParams();
if (this$1.awaitIdentPos > 0)
{ this$1.raise(this$1.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
this$1.yieldPos = oldYieldPos;
this$1.awaitPos = oldAwaitPos;
this$1.awaitIdentPos = oldAwaitIdentPos;
return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)
} }
this$1.checkExpressionErrors(refDestructuringErrors, true); };
this$1.yieldPos = oldYieldPos || this$1.yieldPos;
this$1.awaitPos = oldAwaitPos || this$1.awaitPos; pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
this$1.awaitIdentPos = oldAwaitIdentPos || this$1.awaitIdentPos; var computed = this.eat(types.bracketL);
var node$1 = this$1.startNodeAt(startPos, startLoc); if (computed || this.eat(types.dot)) {
var node = this.startNodeAt(startPos, startLoc);
node.object = base;
node.property = computed ? this.parseExpression() : this.parseIdent(true);
node.computed = !!computed;
if (computed) { this.expect(types.bracketR); }
base = this.finishNode(node, "MemberExpression");
} else if (!noCalls && this.eat(types.parenL)) {
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0)
{ this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.callee = base; node$1.callee = base;
node$1.arguments = exprList; node$1.arguments = exprList;
base = this$1.finishNode(node$1, "CallExpression"); base = this.finishNode(node$1, "CallExpression");
} else if (this$1.type === types.backQuote) { } else if (this.type === types.backQuote) {
var node$2 = this$1.startNodeAt(startPos, startLoc); var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base; node$2.tag = base;
node$2.quasi = this$1.parseTemplate({isTagged: true}); node$2.quasi = this.parseTemplate({isTagged: true});
base = this$1.finishNode(node$2, "TaggedTemplateExpression"); base = this.finishNode(node$2, "TaggedTemplateExpression");
} else { }
return base return base
}
}
}; };
// Parse an atomic expression — either a single token that is an // Parse an atomic expression — either a single token that is an
@ -2868,7 +2874,7 @@ pp$5.exitScope = function() {
// > At the top level of a function, or script, function declarations are // > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations. // > treated like var declarations rather than like lexical declarations.
pp$5.treatFunctionsAsVarInScope = function(scope) { pp$5.treatFunctionsAsVarInScope = function(scope) {
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP); return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
}; };
pp$5.declareName = function(name, bindingType, pos) { pp$5.declareName = function(name, bindingType, pos) {
@ -2894,7 +2900,7 @@ pp$5.declareName = function(name, bindingType, pos) {
} else { } else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) { for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var scope$3 = this$1.scopeStack[i]; var scope$3 = this$1.scopeStack[i];
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name || if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
!this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { !this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
redeclared = true; redeclared = true;
break break
@ -4949,7 +4955,7 @@ pp$8.readWord = function() {
// //
// [walk]: util/walk.js // [walk]: util/walk.js
var version = "6.0.7"; var version = "6.1.0";
// The main exported interface (under `self.acorn` when in the // The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and // browser) is a `parse` function that takes a code string and

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
"homepage": "https://github.com/acornjs/acorn", "homepage": "https://github.com/acornjs/acorn",
"main": "dist/acorn.js", "main": "dist/acorn.js",
"module": "dist/acorn.mjs", "module": "dist/acorn.mjs",
"version": "6.0.7", "version": "6.1.0",
"engines": {"node": ">=0.4.0"}, "engines": {"node": ">=0.4.0"},
"maintainers": [ "maintainers": [
{ {