Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw on duplicate
__proto__
props followed by assignment (#13951)
- Loading branch information
1 parent
dd63950
commit 135ab83
Showing
7 changed files
with
176 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...ges/babel-parser/test/fixtures/es2015/duplicate-proto/with-assignment-expression/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
({ | ||
__proto__: a, | ||
__proto__: a, | ||
a: a = 1 | ||
}) |
95 changes: 95 additions & 0 deletions
95
.../babel-parser/test/fixtures/es2015/duplicate-proto/with-assignment-expression/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, | ||
"errors": [ | ||
"SyntaxError: Redefinition of __proto__ property. (3:2)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":5,"column":2}}, | ||
"expression": { | ||
"type": "ObjectExpression", | ||
"start":1,"end":47,"loc":{"start":{"line":1,"column":1},"end":{"line":5,"column":1}}, | ||
"properties": [ | ||
{ | ||
"type": "ObjectProperty", | ||
"start":5,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":5,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11},"identifierName":"__proto__"}, | ||
"name": "__proto__" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "Identifier", | ||
"start":16,"end":17,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, | ||
"name": "a" | ||
} | ||
}, | ||
{ | ||
"type": "ObjectProperty", | ||
"start":21,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":21,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11},"identifierName":"__proto__"}, | ||
"name": "__proto__" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "Identifier", | ||
"start":32,"end":33,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"a"}, | ||
"name": "a" | ||
} | ||
}, | ||
{ | ||
"type": "ObjectProperty", | ||
"start":37,"end":45,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":10}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":37,"end":38,"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":3},"identifierName":"a"}, | ||
"name": "a" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "AssignmentExpression", | ||
"start":40,"end":45,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":10}}, | ||
"operator": "=", | ||
"left": { | ||
"type": "Identifier", | ||
"start":40,"end":41,"loc":{"start":{"line":4,"column":5},"end":{"line":4,"column":6},"identifierName":"a"}, | ||
"name": "a" | ||
}, | ||
"right": { | ||
"type": "NumericLiteral", | ||
"start":44,"end":45,"loc":{"start":{"line":4,"column":9},"end":{"line":4,"column":10}}, | ||
"extra": { | ||
"rawValue": 1, | ||
"raw": "1" | ||
}, | ||
"value": 1 | ||
} | ||
} | ||
} | ||
], | ||
"extra": { | ||
"parenthesized": true, | ||
"parenStart": 0 | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
.../babel-parser/test/fixtures/es2015/duplicate-proto/without-assignment-expression/input.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
({ | ||
__proto__: a, | ||
__proto__: a, | ||
}) |
65 changes: 65 additions & 0 deletions
65
...bel-parser/test/fixtures/es2015/duplicate-proto/without-assignment-expression/output.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, | ||
"errors": [ | ||
"SyntaxError: Redefinition of __proto__ property. (3:2)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ExpressionStatement", | ||
"start":0,"end":37,"loc":{"start":{"line":1,"column":0},"end":{"line":4,"column":2}}, | ||
"expression": { | ||
"type": "ObjectExpression", | ||
"start":1,"end":36,"loc":{"start":{"line":1,"column":1},"end":{"line":4,"column":1}}, | ||
"properties": [ | ||
{ | ||
"type": "ObjectProperty", | ||
"start":5,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":14}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":5,"end":14,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":11},"identifierName":"__proto__"}, | ||
"name": "__proto__" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "Identifier", | ||
"start":16,"end":17,"loc":{"start":{"line":2,"column":13},"end":{"line":2,"column":14},"identifierName":"a"}, | ||
"name": "a" | ||
} | ||
}, | ||
{ | ||
"type": "ObjectProperty", | ||
"start":21,"end":33,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":14}}, | ||
"method": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":21,"end":30,"loc":{"start":{"line":3,"column":2},"end":{"line":3,"column":11},"identifierName":"__proto__"}, | ||
"name": "__proto__" | ||
}, | ||
"computed": false, | ||
"shorthand": false, | ||
"value": { | ||
"type": "Identifier", | ||
"start":32,"end":33,"loc":{"start":{"line":3,"column":13},"end":{"line":3,"column":14},"identifierName":"a"}, | ||
"name": "a" | ||
} | ||
} | ||
], | ||
"extra": { | ||
"trailingComma": 33, | ||
"parenthesized": true, | ||
"parenStart": 0 | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
packages/babel-parser/test/fixtures/es2015/uncategorised/348/input.js
This file was deleted.
Oops, something went wrong.
72 changes: 0 additions & 72 deletions
72
packages/babel-parser/test/fixtures/es2015/uncategorised/348/output.json
This file was deleted.
Oops, something went wrong.