fix various bugs surfaced by the esprima test suite, remove some incorrect tests

This commit is contained in:
Sebastian McKenzie
2015-08-11 16:58:20 +01:00
parent b7b43dc282
commit 8887444cf7
45 changed files with 704 additions and 703 deletions

View File

@@ -1 +0,0 @@
for (var x = 42 in list) process(x);

View File

@@ -1,195 +0,0 @@
{
"type": "File",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"program": {
"type": "Program",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"sourceType": "script",
"body": [
{
"type": "ForInStatement",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"left": {
"type": "VariableDeclaration",
"start": 5,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 15
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 9,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 15
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
},
"name": "x"
},
"init": {
"type": "Literal",
"start": 13,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 15
}
},
"value": 42,
"rawValue": 42,
"raw": "42"
}
}
],
"kind": "var"
},
"right": {
"type": "Identifier",
"start": 19,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 23
}
},
"name": "list"
},
"body": {
"type": "ExpressionStatement",
"start": 25,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 36
}
},
"expression": {
"type": "CallExpression",
"start": 25,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 35
}
},
"callee": {
"type": "Identifier",
"start": 25,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 32
}
},
"name": "process"
},
"arguments": [
{
"type": "Identifier",
"start": 33,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 34
}
},
"name": "x"
}
]
}
}
}
]
}
}

View File

@@ -1 +0,0 @@
for (var i = function() { return 10 in [] } in list) process(x);

View File

@@ -1,278 +0,0 @@
{
"type": "File",
"start": 0,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 64
}
},
"program": {
"type": "Program",
"start": 0,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 64
}
},
"sourceType": "script",
"body": [
{
"type": "ForInStatement",
"start": 0,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 64
}
},
"left": {
"type": "VariableDeclaration",
"start": 5,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 43
}
},
"declarations": [
{
"type": "VariableDeclarator",
"start": 9,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 43
}
},
"id": {
"type": "Identifier",
"start": 9,
"end": 10,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 10
}
},
"name": "i"
},
"init": {
"type": "FunctionExpression",
"start": 13,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 43
}
},
"id": null,
"generator": false,
"expression": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 24,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 24
},
"end": {
"line": 1,
"column": 43
}
},
"body": [
{
"type": "ReturnStatement",
"start": 26,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 26
},
"end": {
"line": 1,
"column": 41
}
},
"argument": {
"type": "BinaryExpression",
"start": 33,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 41
}
},
"left": {
"type": "Literal",
"start": 33,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 33
},
"end": {
"line": 1,
"column": 35
}
},
"value": 10,
"rawValue": 10,
"raw": "10"
},
"operator": "in",
"right": {
"type": "ArrayExpression",
"start": 39,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 39
},
"end": {
"line": 1,
"column": 41
}
},
"elements": []
}
}
}
]
}
}
}
],
"kind": "var"
},
"right": {
"type": "Identifier",
"start": 47,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 47
},
"end": {
"line": 1,
"column": 51
}
},
"name": "list"
},
"body": {
"type": "ExpressionStatement",
"start": 53,
"end": 64,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 64
}
},
"expression": {
"type": "CallExpression",
"start": 53,
"end": 63,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 63
}
},
"callee": {
"type": "Identifier",
"start": 53,
"end": 60,
"loc": {
"start": {
"line": 1,
"column": 53
},
"end": {
"line": 1,
"column": 60
}
},
"name": "process"
},
"arguments": [
{
"type": "Identifier",
"start": 61,
"end": 62,
"loc": {
"start": {
"line": 1,
"column": 61
},
"end": {
"line": 1,
"column": 62
}
},
"name": "x"
}
]
}
}
}
]
}
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'implements' is reserved (1:37)"
}
"throws": "Binding implements in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'interface' is reserved (1:37)"
}
"throws": "Binding interface in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'package' is reserved (1:37)"
}
"throws": "Binding package in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'private' is reserved (1:37)"
}
"throws": "Binding private in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'protected' is reserved (1:37)"
}
"throws": "Binding protected in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'public' is reserved (1:37)"
}
"throws": "Binding public in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'static' is reserved (1:37)"
}
"throws": "Binding static in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'static' is reserved (1:23)"
}
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Argument name clash in strict mode (1:14)"
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Argument name clash in strict mode (2:14)"
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Argument name clash in strict mode (2:17)"
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Argument name clash in strict mode (2:19)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:20)"
}
"throws": "Argument name clash in strict mode (1:17)"
}

View File

@@ -1,3 +0,0 @@
{
"throws": "Unexpected token (1:10)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected token (1:16)"
}
"throws": "Unexpected token (1:15)"
}

View File

@@ -0,0 +1,153 @@
{
"type": "File",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"expression": {
"type": "FunctionExpression",
"start": 1,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 22
}
},
"id": null,
"generator": true,
"expression": false,
"params": [
{
"type": "ObjectPattern",
"start": 11,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 18
}
},
"properties": [
{
"type": "Property",
"start": 12,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 17
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 12,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 17
}
},
"name": "yield"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 12,
"end": 17,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 17
}
},
"name": "yield"
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 20,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 22
}
},
"body": []
},
"parenthesizedExpression": true
}
}
]
}
}

View File

@@ -1,3 +1,3 @@
{
"throws": "Unexpected super (3:9)"
"throws": "Unexpected super (3:14)"
}

View File

@@ -0,0 +1,148 @@
{
"type": "File",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"program": {
"type": "Program",
"start": 0,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 36
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 13,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 13
}
},
"expression": {
"type": "Literal",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"value": "use strict",
"rawValue": "use strict",
"raw": "\"use strict\""
}
},
{
"type": "FunctionDeclaration",
"start": 14,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 36
}
},
"id": {
"type": "Identifier",
"start": 23,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 24
}
},
"name": "f"
},
"generator": false,
"expression": false,
"params": [],
"body": {
"type": "BlockStatement",
"start": 27,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 27
},
"end": {
"line": 1,
"column": 36
}
},
"body": [
{
"type": "ExpressionStatement",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
}
},
"expression": {
"type": "Identifier",
"start": 29,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 29
},
"end": {
"line": 1,
"column": 34
}
},
"name": "yield"
}
}
]
}
}
]
}
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'implements' is reserved (1:37)"
}
"throws": "Binding implements in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'interface' is reserved (1:37)"
}
"throws": "Binding interface in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'package' is reserved (1:37)"
}
"throws": "Binding package in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'private' is reserved (1:37)"
}
"throws": "Binding private in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'protected' is reserved (1:37)"
}
"throws": "Binding protected in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'public' is reserved (1:37)"
}
"throws": "Binding public in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'static' is reserved (1:37)"
}
"throws": "Binding static in strict mode (1:37)"
}

View File

@@ -1,3 +1,3 @@
{
"throws": "The keyword 'static' is reserved (1:23)"
}
"throws": "Binding static in strict mode (1:23)"
}

View File

@@ -0,0 +1,128 @@
{
"type": "File",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"program": {
"type": "Program",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"sourceType": "module",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 15
}
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"elements": [
{
"type": "RestElement",
"start": 1,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 8
}
},
"argument": {
"type": "Identifier",
"start": 4,
"end": 8,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 8
}
},
"name": "eval"
}
}
]
},
"right": {
"type": "Identifier",
"start": 12,
"end": 15,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 15
}
},
"name": "arr"
}
}
}
]
}
}

View File

@@ -0,0 +1,152 @@
{
"type": "File",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"program": {
"type": "Program",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"sourceType": "script",
"body": [
{
"type": "FunctionDeclaration",
"start": 0,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 23
}
},
"id": {
"type": "Identifier",
"start": 10,
"end": 11,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 11
}
},
"name": "y"
},
"generator": true,
"expression": false,
"params": [
{
"type": "ObjectPattern",
"start": 12,
"end": 19,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 19
}
},
"properties": [
{
"type": "Property",
"start": 13,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 18
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 13,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 18
}
},
"name": "yield"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 13,
"end": 18,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 18
}
},
"name": "yield"
}
}
]
}
],
"body": {
"type": "BlockStatement",
"start": 21,
"end": 23,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 23
}
},
"body": []
}
}
]
}
}

View File

@@ -1 +0,0 @@
(a, a) => 42

View File

@@ -1,119 +0,0 @@
{
"type": "File",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"program": {
"type": "Program",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"expression": {
"type": "ArrowFunctionExpression",
"start": 0,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 12
}
},
"id": null,
"generator": false,
"expression": true,
"params": [
{
"type": "Identifier",
"start": 1,
"end": 2,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 2
}
},
"name": "a"
},
{
"type": "Identifier",
"start": 4,
"end": 5,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 5
}
},
"name": "a"
}
],
"body": {
"type": "Literal",
"start": 10,
"end": 12,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 12
}
},
"value": 42,
"rawValue": 42,
"raw": "42"
}
}
}
]
},
"comments": []
}