add esprima tests and fix bugs picked up by it

This commit is contained in:
Sebastian McKenzie
2015-08-11 00:59:15 +01:00
parent c318c88050
commit df021c7f23
2091 changed files with 82939 additions and 111 deletions

View File

@@ -0,0 +1,99 @@
{
"type": "File",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"program": {
"type": "Program",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 9,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 9
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 7
}
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"start": 1,
"end": 3,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 3
}
},
"properties": []
},
"right": {
"type": "Literal",
"start": 6,
"end": 7,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 7
}
},
"value": 0,
"rawValue": 0,
"raw": "0"
},
"parenthesizedExpression": true
}
}
]
}
}

View File

@@ -0,0 +1 @@
({a:this}=0)

View File

@@ -0,0 +1,3 @@
{
"throws": "Assigning to rvalue (1:4)"
}

View File

@@ -0,0 +1 @@
({a: this} = 0);

View File

@@ -0,0 +1,3 @@
{
"throws": "Assigning to rvalue (1:5)"
}

View File

@@ -0,0 +1,3 @@
{
"throws": "Object pattern can't contain getter or setter (1:6)"
}

View File

@@ -0,0 +1 @@
[[[[[[[[[[[[[[[[[[[[{a=b[0]}]]]]]]]]]]]]]]]]]]]]=0;

View File

@@ -0,0 +1,555 @@
{
"type": "File",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"program": {
"type": "Program",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 51,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 51
}
},
"expression": {
"type": "AssignmentExpression",
"start": 0,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 50
}
},
"operator": "=",
"left": {
"type": "ArrayPattern",
"start": 0,
"end": 48,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 1,
"column": 48
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 1,
"end": 47,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 1,
"column": 47
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 2,
"end": 46,
"loc": {
"start": {
"line": 1,
"column": 2
},
"end": {
"line": 1,
"column": 46
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 3,
"end": 45,
"loc": {
"start": {
"line": 1,
"column": 3
},
"end": {
"line": 1,
"column": 45
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 4,
"end": 44,
"loc": {
"start": {
"line": 1,
"column": 4
},
"end": {
"line": 1,
"column": 44
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 5,
"end": 43,
"loc": {
"start": {
"line": 1,
"column": 5
},
"end": {
"line": 1,
"column": 43
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 6,
"end": 42,
"loc": {
"start": {
"line": 1,
"column": 6
},
"end": {
"line": 1,
"column": 42
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 7,
"end": 41,
"loc": {
"start": {
"line": 1,
"column": 7
},
"end": {
"line": 1,
"column": 41
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 8,
"end": 40,
"loc": {
"start": {
"line": 1,
"column": 8
},
"end": {
"line": 1,
"column": 40
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 9,
"end": 39,
"loc": {
"start": {
"line": 1,
"column": 9
},
"end": {
"line": 1,
"column": 39
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 10,
"end": 38,
"loc": {
"start": {
"line": 1,
"column": 10
},
"end": {
"line": 1,
"column": 38
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 11,
"end": 37,
"loc": {
"start": {
"line": 1,
"column": 11
},
"end": {
"line": 1,
"column": 37
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 12,
"end": 36,
"loc": {
"start": {
"line": 1,
"column": 12
},
"end": {
"line": 1,
"column": 36
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 13,
"end": 35,
"loc": {
"start": {
"line": 1,
"column": 13
},
"end": {
"line": 1,
"column": 35
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 14,
"end": 34,
"loc": {
"start": {
"line": 1,
"column": 14
},
"end": {
"line": 1,
"column": 34
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 15,
"end": 33,
"loc": {
"start": {
"line": 1,
"column": 15
},
"end": {
"line": 1,
"column": 33
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 16,
"end": 32,
"loc": {
"start": {
"line": 1,
"column": 16
},
"end": {
"line": 1,
"column": 32
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 17,
"end": 31,
"loc": {
"start": {
"line": 1,
"column": 17
},
"end": {
"line": 1,
"column": 31
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 18,
"end": 30,
"loc": {
"start": {
"line": 1,
"column": 18
},
"end": {
"line": 1,
"column": 30
}
},
"elements": [
{
"type": "ArrayPattern",
"start": 19,
"end": 29,
"loc": {
"start": {
"line": 1,
"column": 19
},
"end": {
"line": 1,
"column": 29
}
},
"elements": [
{
"type": "ObjectPattern",
"start": 20,
"end": 28,
"loc": {
"start": {
"line": 1,
"column": 20
},
"end": {
"line": 1,
"column": 28
}
},
"properties": [
{
"type": "Property",
"start": 21,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 27
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
}
},
"name": "a"
},
"kind": "init",
"value": {
"type": "AssignmentPattern",
"start": 21,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 27
}
},
"left": {
"type": "Identifier",
"start": 21,
"end": 22,
"loc": {
"start": {
"line": 1,
"column": 21
},
"end": {
"line": 1,
"column": 22
}
},
"name": "a"
},
"right": {
"type": "MemberExpression",
"start": 23,
"end": 27,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 27
}
},
"object": {
"type": "Identifier",
"start": 23,
"end": 24,
"loc": {
"start": {
"line": 1,
"column": 23
},
"end": {
"line": 1,
"column": 24
}
},
"name": "b"
},
"property": {
"type": "Literal",
"start": 25,
"end": 26,
"loc": {
"start": {
"line": 1,
"column": 25
},
"end": {
"line": 1,
"column": 26
}
},
"value": 0,
"rawValue": 0,
"raw": "0"
},
"computed": true
}
}
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
}
]
},
"right": {
"type": "Literal",
"start": 49,
"end": 50,
"loc": {
"start": {
"line": 1,
"column": 49
},
"end": {
"line": 1,
"column": 50
}
},
"value": 0,
"rawValue": 0,
"raw": "0"
}
}
}
]
}
}

View File

@@ -0,0 +1,8 @@
({
a,
a:a,
a:a=a,
[a]:{a},
a:some_call()[a],
a:this.a
} = 0);

View File

@@ -0,0 +1,568 @@
{
"type": "File",
"start": 0,
"end": 85,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 7
}
},
"program": {
"type": "Program",
"start": 0,
"end": 85,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 7
}
},
"sourceType": "script",
"body": [
{
"type": "ExpressionStatement",
"start": 0,
"end": 85,
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 8,
"column": 7
}
},
"expression": {
"type": "AssignmentExpression",
"start": 1,
"end": 83,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 8,
"column": 5
}
},
"operator": "=",
"left": {
"type": "ObjectPattern",
"start": 1,
"end": 79,
"loc": {
"start": {
"line": 1,
"column": 1
},
"end": {
"line": 8,
"column": 1
}
},
"properties": [
{
"type": "Property",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 5
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 5
}
},
"name": "a"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 7,
"end": 8,
"loc": {
"start": {
"line": 2,
"column": 4
},
"end": {
"line": 2,
"column": 5
}
},
"name": "a"
}
},
{
"type": "Property",
"start": 14,
"end": 17,
"loc": {
"start": {
"line": 3,
"column": 4
},
"end": {
"line": 3,
"column": 7
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 14,
"end": 15,
"loc": {
"start": {
"line": 3,
"column": 4
},
"end": {
"line": 3,
"column": 5
}
},
"name": "a"
},
"value": {
"type": "Identifier",
"start": 16,
"end": 17,
"loc": {
"start": {
"line": 3,
"column": 6
},
"end": {
"line": 3,
"column": 7
}
},
"name": "a"
},
"kind": "init"
},
{
"type": "Property",
"start": 23,
"end": 28,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 9
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 23,
"end": 24,
"loc": {
"start": {
"line": 4,
"column": 4
},
"end": {
"line": 4,
"column": 5
}
},
"name": "a"
},
"value": {
"type": "AssignmentPattern",
"start": 25,
"end": 28,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 9
}
},
"left": {
"type": "Identifier",
"start": 25,
"end": 26,
"loc": {
"start": {
"line": 4,
"column": 6
},
"end": {
"line": 4,
"column": 7
}
},
"name": "a"
},
"right": {
"type": "Identifier",
"start": 27,
"end": 28,
"loc": {
"start": {
"line": 4,
"column": 8
},
"end": {
"line": 4,
"column": 9
}
},
"name": "a"
}
},
"kind": "init"
},
{
"type": "Property",
"start": 34,
"end": 41,
"loc": {
"start": {
"line": 5,
"column": 4
},
"end": {
"line": 5,
"column": 11
}
},
"method": false,
"shorthand": false,
"computed": true,
"key": {
"type": "Identifier",
"start": 35,
"end": 36,
"loc": {
"start": {
"line": 5,
"column": 5
},
"end": {
"line": 5,
"column": 6
}
},
"name": "a"
},
"value": {
"type": "ObjectPattern",
"start": 38,
"end": 41,
"loc": {
"start": {
"line": 5,
"column": 8
},
"end": {
"line": 5,
"column": 11
}
},
"properties": [
{
"type": "Property",
"start": 39,
"end": 40,
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 10
}
},
"method": false,
"shorthand": true,
"computed": false,
"key": {
"type": "Identifier",
"start": 39,
"end": 40,
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 10
}
},
"name": "a"
},
"kind": "init",
"value": {
"type": "Identifier",
"start": 39,
"end": 40,
"loc": {
"start": {
"line": 5,
"column": 9
},
"end": {
"line": 5,
"column": 10
}
},
"name": "a"
}
}
]
},
"kind": "init"
},
{
"type": "Property",
"start": 47,
"end": 63,
"loc": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 6,
"column": 20
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 47,
"end": 48,
"loc": {
"start": {
"line": 6,
"column": 4
},
"end": {
"line": 6,
"column": 5
}
},
"name": "a"
},
"value": {
"type": "MemberExpression",
"start": 49,
"end": 63,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 20
}
},
"object": {
"type": "CallExpression",
"start": 49,
"end": 60,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 17
}
},
"callee": {
"type": "Identifier",
"start": 49,
"end": 58,
"loc": {
"start": {
"line": 6,
"column": 6
},
"end": {
"line": 6,
"column": 15
}
},
"name": "some_call"
},
"arguments": []
},
"property": {
"type": "Identifier",
"start": 61,
"end": 62,
"loc": {
"start": {
"line": 6,
"column": 18
},
"end": {
"line": 6,
"column": 19
}
},
"name": "a"
},
"computed": true
},
"kind": "init"
},
{
"type": "Property",
"start": 69,
"end": 77,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 12
}
},
"method": false,
"shorthand": false,
"computed": false,
"key": {
"type": "Identifier",
"start": 69,
"end": 70,
"loc": {
"start": {
"line": 7,
"column": 4
},
"end": {
"line": 7,
"column": 5
}
},
"name": "a"
},
"value": {
"type": "MemberExpression",
"start": 71,
"end": 77,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 12
}
},
"object": {
"type": "ThisExpression",
"start": 71,
"end": 75,
"loc": {
"start": {
"line": 7,
"column": 6
},
"end": {
"line": 7,
"column": 10
}
}
},
"property": {
"type": "Identifier",
"start": 76,
"end": 77,
"loc": {
"start": {
"line": 7,
"column": 11
},
"end": {
"line": 7,
"column": 12
}
},
"name": "a"
},
"computed": false
},
"kind": "init"
}
]
},
"right": {
"type": "Literal",
"start": 82,
"end": 83,
"loc": {
"start": {
"line": 8,
"column": 4
},
"end": {
"line": 8,
"column": 5
}
},
"value": 0,
"rawValue": 0,
"raw": "0"
},
"parenthesizedExpression": true
}
}
]
}
}