| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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 | + | ||
| 1 | 11 | ## 6.0.7 (2019-02-04) | |
| 2 | 12 | ||
| 3 | 13 | ### Bug fixes | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -601,7 +601,7 @@ pp.strictDirective = function(start) { | |||
| 601 | 601 | // Skip semicolon, if any. | |
| 602 | 602 | skipWhiteSpace.lastIndex = start; | |
| 603 | 603 | start += skipWhiteSpace.exec(this$1.input)[0].length; | |
| 604 | - if (this$1.input[start] === ';') | ||
| 604 | + if (this$1.input[start] === ";") | ||
| 605 | 605 | { start++; } | |
| 606 | 606 | } | |
| 607 | 607 | }; | |
@@ -2133,47 +2133,53 @@ pp$3.parseSubscripts = function(base, startPos, startLoc, noCalls) { | |||
| 2133 | 2133 | ||
| 2134 | 2134 | var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && | |
| 2135 | 2135 | 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) | ||
| 2175 | 2167 | } | |
| 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"); | ||
| 2176 | 2181 | } | |
| 2182 | + return base | ||
| 2177 | 2183 | }; | |
| 2178 | 2184 | ||
| 2179 | 2185 | // Parse an atomic expression — either a single token that is an | |
@@ -2868,7 +2874,7 @@ pp$5.exitScope = function() { | |||
| 2868 | 2874 | // > At the top level of a function, or script, function declarations are | |
| 2869 | 2875 | // > treated like var declarations rather than like lexical declarations. | |
| 2870 | 2876 | 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) | ||
| 2872 | 2878 | }; | |
| 2873 | 2879 | ||
| 2874 | 2880 | pp$5.declareName = function(name, bindingType, pos) { | |
@@ -2894,7 +2900,7 @@ pp$5.declareName = function(name, bindingType, pos) { | |||
| 2894 | 2900 | } else { | |
| 2895 | 2901 | for (var i = this.scopeStack.length - 1; i >= 0; --i) { | |
| 2896 | 2902 | 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) || | ||
| 2898 | 2904 | !this$1.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) { | |
| 2899 | 2905 | redeclared = true; | |
| 2900 | 2906 | break | |
@@ -4949,7 +4955,7 @@ pp$8.readWord = function() { | |||
| 4949 | 4955 | // | |
| 4950 | 4956 | // [walk]: util/walk.js | |
| 4951 | 4957 | ||
| 4952 | - var version = "6.0.7"; | ||
| 4958 | + var version = "6.1.0"; | ||
| 4953 | 4959 | ||
| 4954 | 4960 | // The main exported interface (under `self.acorn` when in the | |
| 4955 | 4961 | // browser) is a `parse` function that takes a code string and | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | "homepage": "https://github.com/acornjs/acorn", | |
| 5 | 5 | "main": "dist/acorn.js", | |
| 6 | 6 | "module": "dist/acorn.mjs", | |
| 7 | - "version": "6.0.7", | ||
| 7 | + "version": "6.1.0", | ||
| 8 | 8 | "engines": {"node": ">=0.4.0"}, | |
| 9 | 9 | "maintainers": [ | |
| 10 | 10 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments