Skip to content

Commit

Permalink
Require one VariableDeclarator in VariableDeclaration at least
Browse files Browse the repository at this point in the history
  • Loading branch information
Constellation authored and ariya committed Dec 26, 2012
1 parent e84b53d commit ecb95cf
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
4 changes: 2 additions & 2 deletions esprima.js
Original file line number Diff line number Diff line change
Expand Up @@ -2105,13 +2105,13 @@ parseStatement: true, parseSourceElement: true */
function parseVariableDeclarationList(kind) {
var list = [];

while (index < length) {
do {
list.push(parseVariableDeclaration(kind));
if (!match(',')) {
break;
}
lex();
}
} while (index < length);

return list;
}
Expand Down
21 changes: 21 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16882,6 +16882,27 @@ var testFixture = {
lineNumber: 1,
column: 13,
message: 'Error: Line 1: Use of future reserved word in strict mode'
},

'var': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected end of input'
},

'let': {
index: 3,
lineNumber: 1,
column: 4,
message: 'Error: Line 1: Unexpected end of input'
},

'const': {
index: 5,
lineNumber: 1,
column: 6,
message: 'Error: Line 1: Unexpected end of input'
}

},
Expand Down

0 comments on commit ecb95cf

Please sign in to comment.