diff --git a/acorn.js b/acorn.js index d7e6ce4e85..f01d4a4ef5 100644 --- a/acorn.js +++ b/acorn.js @@ -2258,7 +2258,7 @@ if (strict || !isExpression && node.body.body.length && isUseStrict(node.body.body[0])) { var nameHash = {}; if (node.id) - checkFunctionParam(node.id, nameHash); + checkFunctionParam(node.id, {}); for (var i = 0; i < node.params.length; i++) checkFunctionParam(node.params[i], nameHash); if (node.rest) diff --git a/index.html b/index.html index bfdc2e1c12..d0d5e8de73 100644 --- a/index.html +++ b/index.html @@ -356,16 +356,16 @@ the next one's tokStart will point at the right position.

startLoc, options.locations && new Position); } - function skipLineComment() { + function skipLineComment(startSkip) { var start = tokPos; var startLoc = options.onComment && options.locations && new Position; - var ch = input.charCodeAt(tokPos+=2); + var ch = input.charCodeAt(tokPos+=startSkip); while (tokPos < inputLen && ch !== 10 && ch !== 13 && ch !== 8232 && ch !== 8233) { ++tokPos; ch = input.charCodeAt(tokPos); } if (options.onComment) - options.onComment(false, input.slice(start + 2, tokPos), start, tokPos, + options.onComment(false, input.slice(start + startSkip, tokPos), start, tokPos, startLoc, options.locations && new Position); }

Called at the start of the parse and after every token. Skips whitespace and comments, and.

  function skipSpace() {
@@ -396,7 +396,7 @@ whitespace and comments, and.

if (next === 42) { // '*' skipBlockComment(); } else if (next === 47) { // '/' - skipLineComment(); + skipLineComment(2); } else break; } else if (ch === 160) { // '\xa0' ++tokPos; @@ -457,8 +457,7 @@ into it.

var next = input.charCodeAt(tokPos + 1); if (next === code) { if (next == 45 && input.charCodeAt(tokPos + 2) == 62 && - newline.test(input.slice(lastEnd, tokPos))) {

A --> line comment

        tokPos += 3;
-        skipLineComment();
+          newline.test(input.slice(lastEnd, tokPos))) {

A --> line comment

        skipLineComment(3);
         skipSpace();
         return readToken();
       }
@@ -477,8 +476,7 @@ into it.

return finishOp(_bitShift, size); } if (next == 33 && code == 60 && input.charCodeAt(tokPos + 2) == 45 && - input.charCodeAt(tokPos + 3) == 45) {

<!--, an XML-style comment that should be interpreted as a line comment

      tokPos += 4;
-      skipLineComment();
+        input.charCodeAt(tokPos + 3) == 45) {

<!--, an XML-style comment that should be interpreted as a line comment

      skipLineComment(4);
       skipSpace();
       return readToken();
     }
@@ -1750,7 +1748,7 @@ are not repeated, and it does not try to bind the words eval
 or arguments.

    if (strict || !isExpression && node.body.body.length && isUseStrict(node.body.body[0])) {
       var nameHash = {};
       if (node.id)
-        checkFunctionParam(node.id, nameHash);
+        checkFunctionParam(node.id, {});
       for (var i = 0; i < node.params.length; i++)
         checkFunctionParam(node.params[i], nameHash);
       if (node.rest)
diff --git a/test/tests.js b/test/tests.js
index 211d4a1bec..b51695ad24 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -28785,3 +28785,5 @@ test("