add esprima tests and fix bugs picked up by it
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
({
|
||||
a,
|
||||
a:a,
|
||||
a:a=a,
|
||||
[a]:{a},
|
||||
a:some_call()[a],
|
||||
a:this.a
|
||||
} = 0);
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user