Skip to content

Commit

Permalink
deps: update acorn to 6.1.0
Browse files Browse the repository at this point in the history
PR-URL: #26102
Reviewed-By: Tiancheng "Timothy" Gu <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
gengjiawen authored and addaleax committed Mar 1, 2019
1 parent 4001b24 commit c8d30a7
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 89 deletions.
10 changes: 10 additions & 0 deletions deps/acorn/acorn/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

### Bug fixes
Expand Down
Empty file modified deps/acorn/acorn/bin/acorn
100755 → 100644
Empty file.
92 changes: 49 additions & 43 deletions deps/acorn/acorn/dist/acorn.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion deps/acorn/acorn/dist/acorn.js.map

Large diffs are not rendered by default.

92 changes: 49 additions & 43 deletions deps/acorn/acorn/dist/acorn.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ pp.strictDirective = function(start) {
// Skip semicolon, if any.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this$1.input)[0].length;
if (this$1.input[start] === ';')
if (this$1.input[start] === ";")
{ start++; }
}
};
Expand Down Expand Up @@ -2133,47 +2133,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {

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";
for (var computed = (void 0);;) {
if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) {
var node = this$1.startNodeAt(startPos, startLoc);
node.object = base;
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;
this$1.awaitIdentPos = oldAwaitIdentPos || this$1.awaitIdentPos;
var node$1 = this$1.startNodeAt(startPos, startLoc);
node$1.callee = base;
node$1.arguments = exprList;
base = this$1.finishNode(node$1, "CallExpression");
} else if (this$1.type === types.backQuote) {
var node$2 = this$1.startNodeAt(startPos, startLoc);
node$2.tag = base;
node$2.quasi = this$1.parseTemplate({isTagged: true});
base = this$1.finishNode(node$2, "TaggedTemplateExpression");
} else {
return base
while (true) {
var element = this$1.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
if (element === base || element.type === "ArrowFunctionExpression") { return element }
base = element;
}
};

pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
var computed = this.eat(types.bracketL);
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.arguments = exprList;
base = this.finishNode(node$1, "CallExpression");
} else if (this.type === types.backQuote) {
var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base;
node$2.quasi = this.parseTemplate({isTagged: true});
base = this.finishNode(node$2, "TaggedTemplateExpression");
}
return base
};

// Parse an atomic expression — either a single token that is an
Expand Down Expand Up @@ -2868,7 +2874,7 @@ pp$5.exitScope = function() {
// > At the top level of a function, or script, function declarations are
// > treated like var declarations rather than like lexical declarations.
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) {
Expand All @@ -2894,7 +2900,7 @@ pp$5.declareName = function(name, bindingType, pos) {
} else {
for (var i = this.scopeStack.length - 1; i >= 0; --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) {
redeclared = true;
break
Expand Down Expand Up @@ -4949,7 +4955,7 @@ pp$8.readWord = function() {
//
// [walk]: util/walk.js

var version = "6.0.7";
var version = "6.1.0";

// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and
Expand Down
2 changes: 1 addition & 1 deletion deps/acorn/acorn/dist/acorn.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion deps/acorn/acorn/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://github.com/acornjs/acorn",
"main": "dist/acorn.js",
"module": "dist/acorn.mjs",
"version": "6.0.7",
"version": "6.1.0",
"engines": {"node": ">=0.4.0"},
"maintainers": [
{
Expand Down

0 comments on commit c8d30a7

Please sign in to comment.