Correctly check reserved word for PropertyDefinition: IdentifierReference (#11862)
* fix: check IdentifierReference in PropertyDefinition * chore: add more test cases * fix: incorrect test title
This commit is contained in:
parent
4ac9c7afe2
commit
01d4625412
@ -1785,7 +1785,11 @@ export default class ExpressionParser extends LValParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!prop.computed && prop.key.type === "Identifier") {
|
if (!prop.computed && prop.key.type === "Identifier") {
|
||||||
this.checkReservedWord(prop.key.name, prop.key.start, true, true);
|
// PropertyDefinition:
|
||||||
|
// IdentifierReference
|
||||||
|
// CoveredInitializedName
|
||||||
|
// Note: `{ eval } = {}` will be checked in `checkLVal` later.
|
||||||
|
this.checkReservedWord(prop.key.name, prop.key.start, true, false);
|
||||||
|
|
||||||
if (isPattern) {
|
if (isPattern) {
|
||||||
prop.value = this.parseMaybeDefault(
|
prop.value = this.parseMaybeDefault(
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
"type": "File",
|
"type": "File",
|
||||||
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
"start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":28}},
|
||||||
"errors": [
|
"errors": [
|
||||||
"SyntaxError: Unexpected reserved word 'arguments' (1:8)",
|
|
||||||
"SyntaxError: Binding 'arguments' in strict mode (1:8)"
|
"SyntaxError: Binding 'arguments' in strict mode (1:8)"
|
||||||
],
|
],
|
||||||
"program": {
|
"program": {
|
||||||
@ -2,7 +2,6 @@
|
|||||||
"type": "File",
|
"type": "File",
|
||||||
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}},
|
"start":0,"end":42,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}},
|
||||||
"errors": [
|
"errors": [
|
||||||
"SyntaxError: Unexpected reserved word 'arguments' (2:8)",
|
|
||||||
"SyntaxError: Binding 'arguments' in strict mode (2:8)"
|
"SyntaxError: Binding 'arguments' in strict mode (2:8)"
|
||||||
],
|
],
|
||||||
"program": {
|
"program": {
|
||||||
@ -2,7 +2,6 @@
|
|||||||
"type": "File",
|
"type": "File",
|
||||||
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}},
|
"start":0,"end":39,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":39}},
|
||||||
"errors": [
|
"errors": [
|
||||||
"SyntaxError: Unexpected reserved word 'eval' (1:16)",
|
|
||||||
"SyntaxError: Assigning to 'eval' in strict mode (1:16)"
|
"SyntaxError: Assigning to 'eval' in strict mode (1:16)"
|
||||||
],
|
],
|
||||||
"program": {
|
"program": {
|
||||||
@ -1 +0,0 @@
|
|||||||
var x = ({ const });
|
|
||||||
@ -1,62 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "File",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"errors": [
|
|
||||||
"SyntaxError: Unexpected keyword 'const' (1:11)"
|
|
||||||
],
|
|
||||||
"program": {
|
|
||||||
"type": "Program",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"sourceType": "script",
|
|
||||||
"interpreter": null,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "VariableDeclaration",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"declarations": [
|
|
||||||
{
|
|
||||||
"type": "VariableDeclarator",
|
|
||||||
"start":4,"end":19,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":19}},
|
|
||||||
"id": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"},
|
|
||||||
"name": "x"
|
|
||||||
},
|
|
||||||
"init": {
|
|
||||||
"type": "ObjectExpression",
|
|
||||||
"start":9,"end":18,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}},
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"type": "ObjectProperty",
|
|
||||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}},
|
|
||||||
"method": false,
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"},
|
|
||||||
"name": "const"
|
|
||||||
},
|
|
||||||
"computed": false,
|
|
||||||
"shorthand": true,
|
|
||||||
"value": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"},
|
|
||||||
"name": "const"
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"shorthand": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"extra": {
|
|
||||||
"parenthesized": true,
|
|
||||||
"parenStart": 8
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"kind": "var"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
({ get, this, if });
|
|
||||||
@ -1,91 +0,0 @@
|
|||||||
{
|
|
||||||
"type": "File",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"errors": [
|
|
||||||
"SyntaxError: Unexpected keyword 'this' (1:8)",
|
|
||||||
"SyntaxError: Unexpected keyword 'if' (1:14)"
|
|
||||||
],
|
|
||||||
"program": {
|
|
||||||
"type": "Program",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"sourceType": "script",
|
|
||||||
"interpreter": null,
|
|
||||||
"body": [
|
|
||||||
{
|
|
||||||
"type": "ExpressionStatement",
|
|
||||||
"start":0,"end":20,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":20}},
|
|
||||||
"expression": {
|
|
||||||
"type": "ObjectExpression",
|
|
||||||
"start":1,"end":18,"loc":{"start":{"line":1,"column":1},"end":{"line":1,"column":18}},
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"type": "ObjectProperty",
|
|
||||||
"start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6}},
|
|
||||||
"method": false,
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"get"},
|
|
||||||
"name": "get"
|
|
||||||
},
|
|
||||||
"computed": false,
|
|
||||||
"shorthand": true,
|
|
||||||
"value": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":3,"end":6,"loc":{"start":{"line":1,"column":3},"end":{"line":1,"column":6},"identifierName":"get"},
|
|
||||||
"name": "get"
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"shorthand": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ObjectProperty",
|
|
||||||
"start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12}},
|
|
||||||
"method": false,
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"this"},
|
|
||||||
"name": "this"
|
|
||||||
},
|
|
||||||
"computed": false,
|
|
||||||
"shorthand": true,
|
|
||||||
"value": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":8,"end":12,"loc":{"start":{"line":1,"column":8},"end":{"line":1,"column":12},"identifierName":"this"},
|
|
||||||
"name": "this"
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"shorthand": true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "ObjectProperty",
|
|
||||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16}},
|
|
||||||
"method": false,
|
|
||||||
"key": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"if"},
|
|
||||||
"name": "if"
|
|
||||||
},
|
|
||||||
"computed": false,
|
|
||||||
"shorthand": true,
|
|
||||||
"value": {
|
|
||||||
"type": "Identifier",
|
|
||||||
"start":14,"end":16,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":16},"identifierName":"if"},
|
|
||||||
"name": "if"
|
|
||||||
},
|
|
||||||
"extra": {
|
|
||||||
"shorthand": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"extra": {
|
|
||||||
"parenthesized": true,
|
|
||||||
"parenStart": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"directives": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
1
packages/babel-parser/test/fixtures/es2015/shorthand/get-eval-arguments/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2015/shorthand/get-eval-arguments/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
var x = ({ get, eval, arguments });
|
||||||
99
packages/babel-parser/test/fixtures/es2015/shorthand/get-eval-arguments/output.json
vendored
Normal file
99
packages/babel-parser/test/fixtures/es2015/shorthand/get-eval-arguments/output.json
vendored
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start":0,"end":35,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":35}},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start":4,"end":34,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":34}},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"start":9,"end":33,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":33}},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"get"},
|
||||||
|
"name": "get"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14},"identifierName":"get"},
|
||||||
|
"name": "get"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"eval"},
|
||||||
|
"name": "eval"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"eval"},
|
||||||
|
"name": "eval"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"arguments"},
|
||||||
|
"name": "arguments"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":22,"end":31,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":31},"identifierName":"arguments"},
|
||||||
|
"name": "arguments"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"parenthesized": true,
|
||||||
|
"parenStart": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
2
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word-strict/input.js
vendored
Normal file
2
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word-strict/input.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
"use strict";
|
||||||
|
var x = ({ implements, interface, package });
|
||||||
118
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word-strict/output.json
vendored
Normal file
118
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word-strict/output.json
vendored
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":45}},
|
||||||
|
"errors": [
|
||||||
|
"SyntaxError: Unexpected reserved word 'implements' (2:11)",
|
||||||
|
"SyntaxError: Unexpected reserved word 'interface' (2:23)",
|
||||||
|
"SyntaxError: Unexpected reserved word 'package' (2:34)"
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":59,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":45}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start":14,"end":59,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":45}},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start":18,"end":58,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":44}},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":18,"end":19,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"x"},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"start":23,"end":57,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":43}},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":25,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":21}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":25,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":21},"identifierName":"implements"},
|
||||||
|
"name": "implements"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":25,"end":35,"loc":{"start":{"line":2,"column":11},"end":{"line":2,"column":21},"identifierName":"implements"},
|
||||||
|
"name": "implements"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":37,"end":46,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":32}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":37,"end":46,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":32},"identifierName":"interface"},
|
||||||
|
"name": "interface"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":37,"end":46,"loc":{"start":{"line":2,"column":23},"end":{"line":2,"column":32},"identifierName":"interface"},
|
||||||
|
"name": "interface"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":48,"end":55,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":41}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":48,"end":55,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":41},"identifierName":"package"},
|
||||||
|
"name": "package"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":48,"end":55,"loc":{"start":{"line":2,"column":34},"end":{"line":2,"column":41},"identifierName":"package"},
|
||||||
|
"name": "package"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"parenthesized": true,
|
||||||
|
"parenStart": 22
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": [
|
||||||
|
{
|
||||||
|
"type": "Directive",
|
||||||
|
"start":0,"end":13,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":13}},
|
||||||
|
"value": {
|
||||||
|
"type": "DirectiveLiteral",
|
||||||
|
"start":0,"end":12,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":12}},
|
||||||
|
"value": "use strict",
|
||||||
|
"extra": {
|
||||||
|
"raw": "\"use strict\"",
|
||||||
|
"rawValue": "use strict"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
1
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word/input.js
vendored
Normal file
1
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word/input.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
var x = ({ const, if, this });
|
||||||
104
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word/output.json
vendored
Normal file
104
packages/babel-parser/test/fixtures/es2015/shorthand/reserved-word/output.json
vendored
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
{
|
||||||
|
"type": "File",
|
||||||
|
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||||
|
"errors": [
|
||||||
|
"SyntaxError: Unexpected keyword 'const' (1:11)",
|
||||||
|
"SyntaxError: Unexpected keyword 'if' (1:18)",
|
||||||
|
"SyntaxError: Unexpected keyword 'this' (1:22)"
|
||||||
|
],
|
||||||
|
"program": {
|
||||||
|
"type": "Program",
|
||||||
|
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||||
|
"sourceType": "script",
|
||||||
|
"interpreter": null,
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclaration",
|
||||||
|
"start":0,"end":30,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":30}},
|
||||||
|
"declarations": [
|
||||||
|
{
|
||||||
|
"type": "VariableDeclarator",
|
||||||
|
"start":4,"end":29,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":29}},
|
||||||
|
"id": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":4,"end":5,"loc":{"start":{"line":1,"column":4},"end":{"line":1,"column":5},"identifierName":"x"},
|
||||||
|
"name": "x"
|
||||||
|
},
|
||||||
|
"init": {
|
||||||
|
"type": "ObjectExpression",
|
||||||
|
"start":9,"end":28,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":28}},
|
||||||
|
"properties": [
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"},
|
||||||
|
"name": "const"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":11,"end":16,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":16},"identifierName":"const"},
|
||||||
|
"name": "const"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20},"identifierName":"if"},
|
||||||
|
"name": "if"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":18,"end":20,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":20},"identifierName":"if"},
|
||||||
|
"name": "if"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ObjectProperty",
|
||||||
|
"start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26}},
|
||||||
|
"method": false,
|
||||||
|
"key": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26},"identifierName":"this"},
|
||||||
|
"name": "this"
|
||||||
|
},
|
||||||
|
"computed": false,
|
||||||
|
"shorthand": true,
|
||||||
|
"value": {
|
||||||
|
"type": "Identifier",
|
||||||
|
"start":22,"end":26,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":26},"identifierName":"this"},
|
||||||
|
"name": "this"
|
||||||
|
},
|
||||||
|
"extra": {
|
||||||
|
"shorthand": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"extra": {
|
||||||
|
"parenthesized": true,
|
||||||
|
"parenStart": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kind": "var"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"directives": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user