Skip to content

Commit c8d30a7

Browse files
gengjiawenaddaleax
authored andcommitted
deps: update acorn to 6.1.0
PR-URL: #26102 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent 4001b24 commit c8d30a7

File tree

7 files changed

+111
-89
lines changed

7 files changed

+111
-89
lines changed

deps/acorn/acorn/CHANGELOG.md

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 6.1.0 (2019-02-08)
2+
3+
### Bug fixes
4+
5+
Fix scope checking when redefining a `var` as a lexical binding.
6+
7+
### New features
8+
9+
Split up `parseSubscripts` to use an internal `parseSubscript` method to make it easier to extend with plugins.
10+
111
## 6.0.7 (2019-02-04)
212

313
### Bug fixes

deps/acorn/acorn/bin/acorn

100755100644
File mode changed.

deps/acorn/acorn/dist/acorn.js

+49-43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/acorn/acorn/dist/acorn.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps/acorn/acorn/dist/acorn.mjs

+49-43
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ pp.strictDirective = function(start) {
601601
// Skip semicolon, if any.
602602
skipWhiteSpace.lastIndex = start;
603603
start += skipWhiteSpace.exec(this$1.input)[0].length;
604-
if (this$1.input[start] === ';')
604+
if (this$1.input[start] === ";")
605605
{ start++; }
606606
}
607607
};
@@ -2133,47 +2133,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) {
21332133

21342134
var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" &&
21352135
this.lastTokEnd === base.end && !this.canInsertSemicolon() && this.input.slice(base.start, base.end) === "async";
2136-
for (var computed = (void 0);;) {
2137-
if ((computed = this$1.eat(types.bracketL)) || this$1.eat(types.dot)) {
2138-
var node = this$1.startNodeAt(startPos, startLoc);
2139-
node.object = base;
2140-
node.property = computed ? this$1.parseExpression() : this$1.parseIdent(true);
2141-
node.computed = !!computed;
2142-
if (computed) { this$1.expect(types.bracketR); }
2143-
base = this$1.finishNode(node, "MemberExpression");
2144-
} else if (!noCalls && this$1.eat(types.parenL)) {
2145-
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this$1.yieldPos, oldAwaitPos = this$1.awaitPos, oldAwaitIdentPos = this$1.awaitIdentPos;
2146-
this$1.yieldPos = 0;
2147-
this$1.awaitPos = 0;
2148-
this$1.awaitIdentPos = 0;
2149-
var exprList = this$1.parseExprList(types.parenR, this$1.options.ecmaVersion >= 8, false, refDestructuringErrors);
2150-
if (maybeAsyncArrow && !this$1.canInsertSemicolon() && this$1.eat(types.arrow)) {
2151-
this$1.checkPatternErrors(refDestructuringErrors, false);
2152-
this$1.checkYieldAwaitInDefaultParams();
2153-
if (this$1.awaitIdentPos > 0)
2154-
{ this$1.raise(this$1.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
2155-
this$1.yieldPos = oldYieldPos;
2156-
this$1.awaitPos = oldAwaitPos;
2157-
this$1.awaitIdentPos = oldAwaitIdentPos;
2158-
return this$1.parseArrowExpression(this$1.startNodeAt(startPos, startLoc), exprList, true)
2159-
}
2160-
this$1.checkExpressionErrors(refDestructuringErrors, true);
2161-
this$1.yieldPos = oldYieldPos || this$1.yieldPos;
2162-
this$1.awaitPos = oldAwaitPos || this$1.awaitPos;
2163-
this$1.awaitIdentPos = oldAwaitIdentPos || this$1.awaitIdentPos;
2164-
var node$1 = this$1.startNodeAt(startPos, startLoc);
2165-
node$1.callee = base;
2166-
node$1.arguments = exprList;
2167-
base = this$1.finishNode(node$1, "CallExpression");
2168-
} else if (this$1.type === types.backQuote) {
2169-
var node$2 = this$1.startNodeAt(startPos, startLoc);
2170-
node$2.tag = base;
2171-
node$2.quasi = this$1.parseTemplate({isTagged: true});
2172-
base = this$1.finishNode(node$2, "TaggedTemplateExpression");
2173-
} else {
2174-
return base
2136+
while (true) {
2137+
var element = this$1.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow);
2138+
if (element === base || element.type === "ArrowFunctionExpression") { return element }
2139+
base = element;
2140+
}
2141+
};
2142+
2143+
pp$3.parseSubscript = function(base, startPos, startLoc, noCalls, maybeAsyncArrow) {
2144+
var computed = this.eat(types.bracketL);
2145+
if (computed || this.eat(types.dot)) {
2146+
var node = this.startNodeAt(startPos, startLoc);
2147+
node.object = base;
2148+
node.property = computed ? this.parseExpression() : this.parseIdent(true);
2149+
node.computed = !!computed;
2150+
if (computed) { this.expect(types.bracketR); }
2151+
base = this.finishNode(node, "MemberExpression");
2152+
} else if (!noCalls && this.eat(types.parenL)) {
2153+
var refDestructuringErrors = new DestructuringErrors, oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
2154+
this.yieldPos = 0;
2155+
this.awaitPos = 0;
2156+
this.awaitIdentPos = 0;
2157+
var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
2158+
if (maybeAsyncArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) {
2159+
this.checkPatternErrors(refDestructuringErrors, false);
2160+
this.checkYieldAwaitInDefaultParams();
2161+
if (this.awaitIdentPos > 0)
2162+
{ this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function"); }
2163+
this.yieldPos = oldYieldPos;
2164+
this.awaitPos = oldAwaitPos;
2165+
this.awaitIdentPos = oldAwaitIdentPos;
2166+
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true)
21752167
}
2168+
this.checkExpressionErrors(refDestructuringErrors, true);
2169+
this.yieldPos = oldYieldPos || this.yieldPos;
2170+
this.awaitPos = oldAwaitPos || this.awaitPos;
2171+
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
2172+
var node$1 = this.startNodeAt(startPos, startLoc);
2173+
node$1.callee = base;
2174+
node$1.arguments = exprList;
2175+
base = this.finishNode(node$1, "CallExpression");
2176+
} else if (this.type === types.backQuote) {
2177+
var node$2 = this.startNodeAt(startPos, startLoc);
2178+
node$2.tag = base;
2179+
node$2.quasi = this.parseTemplate({isTagged: true});
2180+
base = this.finishNode(node$2, "TaggedTemplateExpression");
21762181
}
2182+
return base
21772183
};
21782184

21792185
// Parse an atomic expression — either a single token that is an
@@ -2868,7 +2874,7 @@ pp$5.exitScope = function() {
28682874
// > At the top level of a function, or script, function declarations are
28692875
// > treated like var declarations rather than like lexical declarations.
28702876
pp$5.treatFunctionsAsVarInScope = function(scope) {
2871-
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP);
2877+
return (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
28722878
};
28732879

28742880
pp$5.declareName = function(name, bindingType, pos) {
@@ -2894,7 +2900,7 @@ pp$5.declareName = function(name, bindingType, pos) {
28942900
} else {
28952901
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
28962902
var scope$3 = this$1.scopeStack[i];
2897-
if (scope$3.lexical.indexOf(name) > -1 && !(scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name ||
2903+
if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
28982904
!this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
28992905
redeclared = true;
29002906
break
@@ -4949,7 +4955,7 @@ pp$8.readWord = function() {
49494955
//
49504956
// [walk]: util/walk.js
49514957

4952-
var version = "6.0.7";
4958+
var version = "6.1.0";
49534959

49544960
// The main exported interface (under `self.acorn` when in the
49554961
// browser) is a `parse` function that takes a code string and

deps/acorn/acorn/dist/acorn.mjs.map

+1-1
Large diffs are not rendered by default.

deps/acorn/acorn/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"homepage": "https://github.com/acornjs/acorn",
55
"main": "dist/acorn.js",
66
"module": "dist/acorn.mjs",
7-
"version": "6.0.7",
7+
"version": "6.1.0",
88
"engines": {"node": ">=0.4.0"},
99
"maintainers": [
1010
{

0 commit comments

Comments
 (0)