Skip to content

Commit c36b154

Browse files
committedDec 22, 2024·
fix: proper parsing of BindingPattern and BindingElement
Introduced a new AST node type called `.binding_identifier`. ```js let x = 123; // x is a .binding_identifier console.log(x) // x is an .identifier ``` The parsing of binding patterns (LHS of var declarators, catch and function parameters) now shares no code with parsing of object or array patterns in normal assignments.
1 parent 969059d commit c36b154

File tree

33 files changed

+233
-218
lines changed

33 files changed

+233
-218
lines changed
 

‎parser-tests/errors/dupl-bind.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// ERROR: Variable 'x' has already been declared
2+
3+
let { y: x } = 456;
4+
{
5+
var { x: x } = 123;
6+
}
7+

‎pre-commit

+5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@
22

33
set -euo pipefail
44

5+
# Run unit tests for each module
6+
echo "Running unit tests"
7+
zig build test
8+
59
# Download the results.json file from the main branch on github, and compare with the current results.json file
610
echo "Downloading results.json from main branch on GH"
711
curl https://raw.githubusercontent.com/srijan-paul/jam/refs/heads/main/tools/results.json -o ./results-old.json
812
echo "Comparing results.json files"
913
zig build test-262 -- --compare ./results-old.json
1014
rm ./results-old.json
15+

‎src/fmt/js_format.zig

+5
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ pub fn updateExpr(_: *Self, _: *const ast.NodeData) Doc.Id {
149149
pub fn identifier(_: *Self, _: *const ast.NodeData) Doc.Id {
150150
unreachable;
151151
}
152+
153+
pub fn bindingIdentifier(_: *Self, _: *const ast.NodeData) Doc.Id {
154+
unreachable;
155+
}
156+
152157
pub fn numberLiteral(_: *Self, _: *const ast.NodeData) Doc.Id {
153158
unreachable;
154159
}

‎src/js/ast.zig

+1
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ pub const NodeData = union(enum(u8)) {
433433
update_expr: UnaryPayload,
434434

435435
identifier: String,
436+
binding_identifier: String,
436437

437438
string_literal: Token.Index,
438439
number_literal: Number,

‎src/js/estree.zig

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ pub fn jamToEstreeTag(node: ast.NodeData) []const u8 {
114114
.await_expr => "AwaitExpression",
115115
.yield_expr => "YieldExpression",
116116
.update_expr => "UpdateExpression",
117-
.identifier => "Identifier",
117+
118+
.binding_identifier, .identifier => "Identifier",
118119

119120
.string_literal,
120121
.number_literal,
@@ -220,7 +221,7 @@ fn nodeToEsTree(
220221
try o.put("right", rhs);
221222
},
222223

223-
.identifier => |s| {
224+
.binding_identifier, .identifier => |s| {
224225
const name = t.string_pool.toByteSlice(s);
225226
try o.put("name", JValue{ .string = name });
226227
},

‎src/js/parser.zig

+155-140
Large diffs are not rendered by default.

‎tools/babel-results.json

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"coverage": "63.67360%",
2+
"coverage": "64.30372%",
33
"cases": {
44
"core/scope/dupl-bind-nested-var-let": "pass",
55
"core/scope/for-let": "pass",
@@ -418,14 +418,14 @@
418418
"core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-2": "pass",
419419
"core/create-parenthesized-expressions/valid-parenthesized-assignment-array-pattern-1": "pass",
420420
"core/regression/non-octal-float": "pass",
421-
"core/regression/use-strict-with-pre-semi": "fail_with_ast_mismatch",
421+
"core/regression/use-strict-with-pre-semi": "pass",
422422
"core/regression/2591": "pass",
423423
"core/regression/9374": "fail_with_ast_mismatch",
424424
"es2015/yield/parameter-default-inside-function": "pass",
425425
"es2015/yield/parameter-default-inside-function-inside-generator": "pass",
426426
"es2015/yield/yield-star-in-arrow-scope-is-multiplication": "fail_with_ast_mismatch",
427427
"es2015/yield/inside-arrow-inside-generator": "fail_with_ast_mismatch",
428-
"es2015/yield/yield-star-parameter-default-inside-function": "fail_with_ast_mismatch",
428+
"es2015/yield/yield-star-parameter-default-inside-function": "pass",
429429
"es2015/yield/function-name-inside-function": "pass",
430430
"es2015/yield/parameter-name-arrow-inside-arrow-inside-generator": "fail_with_ast_mismatch",
431431
"es2015/yield/yield-following-arrow-in-params": "fail_with_ast_mismatch",
@@ -455,7 +455,7 @@
455455
"es2015/yield/yield-star-inside-generator-function-expression": "pass",
456456
"es2015/yield/parameter-name-arrow-no-parens": "fail_with_ast_mismatch",
457457
"es2015/yield/yield-star-inside-generator-function-declaration": "pass",
458-
"es2015/yield/yield-identifier-inside-async-call-inside-function-inside-params-of-generator": "fail_with_ast_mismatch",
458+
"es2015/yield/yield-identifier-inside-async-call-inside-function-inside-params-of-generator": "pass",
459459
"es2015/yield/basic-without-argument": "fail_with_ast_mismatch",
460460
"es2015/yield/parameter-default-inside-arrow": "fail_with_ast_mismatch",
461461
"es2015/meta-properties/expression": "pass",
@@ -497,7 +497,7 @@
497497
"es2015/uncategorised/116": "fail_with_ast_mismatch",
498498
"es2015/uncategorised/133": "fail_with_ast_mismatch",
499499
"es2015/uncategorised/131": "fail_with_ast_mismatch",
500-
"es2015/uncategorised/155": "fail_with_ast_mismatch",
500+
"es2015/uncategorised/155": "pass",
501501
"es2015/uncategorised/160": "pass",
502502
"es2015/uncategorised/137": "fail_with_ast_mismatch",
503503
"es2015/uncategorised/61": "pass",
@@ -512,7 +512,7 @@
512512
"es2015/uncategorised/45": "fail_with_ast_mismatch",
513513
"es2015/uncategorised/39": "fail_with_ast_mismatch",
514514
"es2015/uncategorised/320": "pass",
515-
"es2015/uncategorised/153": "fail_with_ast_mismatch",
515+
"es2015/uncategorised/153": "pass",
516516
"es2015/uncategorised/111": "fail_with_ast_mismatch",
517517
"es2015/uncategorised/167": "pass",
518518
"es2015/uncategorised/97": "fail_with_ast_mismatch",
@@ -528,16 +528,16 @@
528528
"es2015/uncategorised/338": "fail_with_ast_mismatch",
529529
"es2015/uncategorised/32": "fail_with_ast_mismatch",
530530
"es2015/uncategorised/393": "fail_with_ast_mismatch",
531-
"es2015/uncategorised/190": "fail_with_ast_mismatch",
531+
"es2015/uncategorised/190": "pass",
532532
"es2015/uncategorised/19": "fail_with_ast_mismatch",
533533
"es2015/uncategorised/279": "pass",
534534
"es2015/uncategorised/188": "pass",
535535
"es2015/uncategorised/132": "fail_with_ast_mismatch",
536-
"es2015/uncategorised/152": "fail_with_ast_mismatch",
536+
"es2015/uncategorised/152": "pass",
537537
"es2015/uncategorised/383": "fail_with_ast_mismatch",
538538
"es2015/uncategorised/380": "fail_with_ast_mismatch",
539539
"es2015/uncategorised/356": "fail_with_ast_mismatch",
540-
"es2015/uncategorised/168": "fail_with_ast_mismatch",
540+
"es2015/uncategorised/168": "pass",
541541
"es2015/uncategorised/40": "fail_with_ast_mismatch",
542542
"es2015/uncategorised/196": "pass",
543543
"es2015/uncategorised/135": "fail_with_ast_mismatch",
@@ -619,7 +619,7 @@
619619
"es2015/uncategorised/92": "fail_with_ast_mismatch",
620620
"es2015/uncategorised/74": "fail_with_ast_mismatch",
621621
"es2015/uncategorised/171": "pass",
622-
"es2015/uncategorised/172": "fail_with_ast_mismatch",
622+
"es2015/uncategorised/172": "pass",
623623
"es2015/uncategorised/30": "fail_with_ast_mismatch",
624624
"es2015/uncategorised/18": "fail_with_ast_mismatch",
625625
"es2015/uncategorised/34": "fail_with_ast_mismatch",
@@ -636,13 +636,13 @@
636636
"es2015/uncategorised/150": "fail_with_ast_mismatch",
637637
"es2015/uncategorised/47": "fail_with_ast_mismatch",
638638
"es2015/uncategorised/17": "fail_with_ast_mismatch",
639-
"es2015/uncategorised/156": "fail_with_ast_mismatch",
639+
"es2015/uncategorised/156": "pass",
640640
"es2015/uncategorised/318": "fail_with_ast_mismatch",
641641
"es2015/uncategorised/65": "pass",
642642
"es2015/uncategorised/181": "fail_with_ast_mismatch",
643643
"es2015/uncategorised/105": "pass",
644644
"es2015/uncategorised/23": "fail_with_ast_mismatch",
645-
"es2015/uncategorised/154": "fail_with_ast_mismatch",
645+
"es2015/uncategorised/154": "pass",
646646
"es2015/uncategorised/48": "fail_with_ast_mismatch",
647647
"es2015/uncategorised/20": "fail_with_ast_mismatch",
648648
"es2015/uncategorised/55": "pass",
@@ -664,7 +664,7 @@
664664
"es2015/uncategorised/159": "pass",
665665
"es2015/uncategorised/165": "pass",
666666
"es2015/uncategorised/119": "fail_with_ast_mismatch",
667-
"es2015/uncategorised/175": "fail_with_ast_mismatch",
667+
"es2015/uncategorised/175": "pass",
668668
"es2015/uncategorised/27": "fail_with_ast_mismatch",
669669
"es2015/uncategorised/176": "fail_with_ast_mismatch",
670670
"es2015/uncategorised/180": "fail_with_ast_mismatch",
@@ -769,7 +769,7 @@
769769
"es2017/async-functions/1": "fail_with_ast_mismatch",
770770
"es2017/async-functions/13": "pass",
771771
"es2017/async-functions/7": "pass",
772-
"es2017/async-functions/await-inside-async-function-body-inside-parameters-of-function": "fail_with_ast_mismatch",
772+
"es2017/async-functions/await-inside-async-function-body-inside-parameters-of-function": "pass",
773773
"es2017/async-functions/31": "fail_with_ast_mismatch",
774774
"es2017/async-functions/await-async-function-declaration-name": "pass",
775775
"es2017/async-functions/await-as-argument-identifier-in-non-async-functions": "fail_with_ast_mismatch",
@@ -789,7 +789,7 @@
789789
"es2017/async-functions/8": "pass",
790790
"es2017/async-functions/27": "fail_with_ast_mismatch",
791791
"es2017/async-functions/export": "fail_with_ast_mismatch",
792-
"es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function": "fail_with_ast_mismatch",
792+
"es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function": "pass",
793793
"es2017/async-functions/await-following-arrow-inside-params": "fail_with_ast_mismatch",
794794
"es2017/async-functions/export-arrow": "fail_with_ast_mismatch",
795795
"es2017/async-functions/await-inside-arrow-identifier-allowed": "fail_with_ast_mismatch",
@@ -821,9 +821,7 @@
821821
"es2018/object-rest-spread/comma-after-spread": "pass",
822822
"es2018/object-rest-spread/4": "pass",
823823
"es2018/object-rest-spread/10": "pass",
824-
"es2018/object-rest-spread/1": "pass",
825824
"es2018/object-rest-spread/5": "pass",
826-
"es2018/object-rest-spread/2": "pass",
827825
"es2018/async-generators/class-method-2": "fail_with_ast_mismatch",
828826
"es2018/async-generators/object-method": "fail_with_ast_mismatch",
829827
"es2018/async-generators/class-method-no-asi": "fail_with_ast_mismatch",
@@ -1363,7 +1361,7 @@
13631361
"esprima/es2015-object-pattern/empty-catch-param": "pass",
13641362
"esprima/es2015-object-pattern/empty-fn": "pass",
13651363
"esprima/es2015-object-pattern/properties": "fail_with_ast_mismatch",
1366-
"esprima/es2015-object-pattern/nested": "fail_with_ast_mismatch",
1364+
"esprima/es2015-object-pattern/nested": "pass",
13671365
"esprima/es2015-object-pattern/empty-for-lex": "pass",
13681366
"esprima/es2015-object-pattern/elision": "pass",
13691367
"esprima/es2015-object-pattern/empty-lexical": "pass",
@@ -1420,7 +1418,7 @@
14201418
"esprima/es2015-object-initialiser/proto-identifier-setter": "fail_with_ast_mismatch",
14211419
"esprima/es2015-object-initialiser/proto-shorthand-literal": "pass",
14221420
"esprima/es2015-object-initialiser/proto-identifier-method": "pass",
1423-
"esprima/es2015-array-pattern/with-object-pattern": "fail_with_ast_mismatch",
1421+
"esprima/es2015-array-pattern/with-object-pattern": "pass",
14241422
"esprima/es2015-array-pattern/with-default-catch-param": "pass",
14251423
"esprima/es2015-array-pattern/hole": "pass",
14261424
"esprima/es2015-array-pattern/empty-pattern-var": "pass",
@@ -1431,7 +1429,7 @@
14311429
"esprima/es2015-array-pattern/patterned-catch": "fail_with_ast_mismatch",
14321430
"esprima/es2015-array-pattern/elision": "pass",
14331431
"esprima/es2015-array-pattern/rest": "pass",
1434-
"esprima/es2015-array-pattern/nested-pattern": "fail_with_ast_mismatch",
1432+
"esprima/es2015-array-pattern/nested-pattern": "pass",
14351433
"esprima/es2015-array-pattern/empty-pattern-lexical": "pass",
14361434
"esprima/expression-primary-array/migrated_0003": "pass",
14371435
"esprima/expression-primary-array/migrated_0009": "pass",

‎tools/babel/core/regression/use-strict-with-pre-semi/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 12,
24-
"end": 19,
24+
"end": 20,
2525
"left": {
2626
"type": "ArrayPattern",
2727
"start": 12,

‎tools/babel/es2015/meta-properties/new-target-inside-params/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 13,
24-
"end": 20,
24+
"end": 27,
2525
"left": {
2626
"type": "Identifier",
2727
"start": 13,

‎tools/babel/es2015/uncategorised/152/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 11,
24-
"end": 18,
24+
"end": 20,
2525
"left": {
2626
"type": "ArrayPattern",
2727
"start": 11,

‎tools/babel/es2015/uncategorised/153/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 11,
24-
"end": 18,
24+
"end": 24,
2525
"left": {
2626
"type": "ObjectPattern",
2727
"start": 11,

‎tools/babel/es2015/uncategorised/154/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{
3232
"type": "AssignmentPattern",
3333
"start": 13,
34-
"end": 20,
34+
"end": 26,
3535
"left": {
3636
"type": "ObjectPattern",
3737
"start": 13,

‎tools/babel/es2015/uncategorised/155/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{
3939
"type": "AssignmentPattern",
4040
"start": 14,
41-
"end": 21,
41+
"end": 27,
4242
"left": {
4343
"type": "ObjectPattern",
4444
"start": 14,

‎tools/babel/es2015/uncategorised/156/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{
3939
"type": "AssignmentPattern",
4040
"start": 4,
41-
"end": 11,
41+
"end": 17,
4242
"left": {
4343
"type": "ObjectPattern",
4444
"start": 4,

‎tools/babel/es2015/uncategorised/157/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
{
3838
"type": "AssignmentPattern",
3939
"start": 10,
40-
"end": 17,
40+
"end": 23,
4141
"left": {
4242
"type": "ObjectPattern",
4343
"start": 10,

‎tools/babel/es2015/uncategorised/168/output.jam.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"computed": false,
3838
"shorthand": false,
3939
"value": {
40-
"type": "ObjectExpression",
40+
"type": "ObjectPattern",
4141
"start": 16,
4242
"end": 24,
4343
"properties": [
@@ -101,7 +101,7 @@
101101
"computed": false,
102102
"shorthand": false,
103103
"value": {
104-
"type": "ArrayExpression",
104+
"type": "ArrayPattern",
105105
"start": 29,
106106
"end": 35,
107107
"elements": [

‎tools/babel/es2015/uncategorised/172/output.jam.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"computed": false,
4343
"shorthand": false,
4444
"value": {
45-
"type": "ObjectExpression",
45+
"type": "ObjectPattern",
4646
"start": 17,
4747
"end": 25,
4848
"properties": [
@@ -106,7 +106,7 @@
106106
"computed": false,
107107
"shorthand": false,
108108
"value": {
109-
"type": "ArrayExpression",
109+
"type": "ArrayPattern",
110110
"start": 30,
111111
"end": 36,
112112
"elements": [

‎tools/babel/es2015/uncategorised/175/output.jam.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"computed": false,
5555
"shorthand": false,
5656
"value": {
57-
"type": "ObjectExpression",
57+
"type": "ObjectPattern",
5858
"start": 10,
5959
"end": 18,
6060
"properties": [
@@ -118,7 +118,7 @@
118118
"computed": false,
119119
"shorthand": false,
120120
"value": {
121-
"type": "ArrayExpression",
121+
"type": "ArrayPattern",
122122
"start": 23,
123123
"end": 29,
124124
"elements": [

‎tools/babel/es2015/uncategorised/190/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"end": 20,
2121
"elements": [
2222
{
23-
"type": "ObjectExpression",
23+
"type": "ObjectPattern",
2424
"start": 5,
2525
"end": 13,
2626
"properties": [

‎tools/babel/es2015/yield/yield-following-arrow-in-params/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{
3939
"type": "AssignmentPattern",
4040
"start": 29,
41-
"end": 32,
41+
"end": 39,
4242
"left": {
4343
"type": "Identifier",
4444
"start": 29,

‎tools/babel/es2015/yield/yield-identifier-inside-async-call-inside-function-inside-params-of-generator/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 13,
24-
"end": 25,
24+
"end": 44,
2525
"left": {
2626
"type": "Identifier",
2727
"start": 13,

‎tools/babel/es2015/yield/yield-star-parameter-default-inside-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 12,
24-
"end": 21,
24+
"end": 28,
2525
"left": {
2626
"type": "Identifier",
2727
"start": 12,

‎tools/babel/es2017/async-functions/await-following-arrow-inside-params/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
{
3939
"type": "AssignmentPattern",
4040
"start": 34,
41-
"end": 37,
41+
"end": 44,
4242
"left": {
4343
"type": "Identifier",
4444
"start": 34,

‎tools/babel/es2017/async-functions/await-identifier-class-binding-inside-params-of-function-inside-params-of-async-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
{
4545
"type": "AssignmentPattern",
4646
"start": 22,
47-
"end": 31,
47+
"end": 40,
4848
"left": {
4949
"type": "Identifier",
5050
"start": 22,

‎tools/babel/es2017/async-functions/await-inside-async-call-inside-parameters-of-function-inside-async-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
{
4040
"type": "AssignmentPattern",
4141
"start": 34,
42-
"end": 43,
42+
"end": 50,
4343
"left": {
4444
"type": "Identifier",
4545
"start": 34,

‎tools/babel/es2017/async-functions/await-inside-async-function-body-inside-parameters-of-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 12,
24-
"end": 21,
24+
"end": 45,
2525
"left": {
2626
"type": "Identifier",
2727
"start": 12,

‎tools/babel/es2017/async-functions/await-inside-concise-body-of-async-arrow-inside-parameters-of-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
{
2222
"type": "AssignmentPattern",
2323
"start": 12,
24-
"end": 23,
24+
"end": 35,
2525
"left": {
2626
"type": "Identifier",
2727
"start": 12,

‎tools/babel/es2022/class-properties/await-identifier-in-computed-property-inside-params-of-function-inside-params-of-async-function/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
{
4545
"type": "AssignmentPattern",
4646
"start": 22,
47-
"end": 31,
47+
"end": 43,
4848
"left": {
4949
"type": "Identifier",
5050
"start": 22,

‎tools/babel/esprima/es2015-array-pattern/nested-pattern/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"end": 8,
2121
"elements": [
2222
{
23-
"type": "ArrayExpression",
23+
"type": "ArrayPattern",
2424
"start": 5,
2525
"end": 7,
2626
"elements": []

‎tools/babel/esprima/es2015-array-pattern/patterned-catch/output.jam.json

+11-28
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"name": "b"
3838
},
3939
{
40-
"type": "ObjectExpression",
40+
"type": "ObjectPattern",
4141
"start": 20,
4242
"end": 44,
4343
"properties": [
@@ -76,10 +76,9 @@
7676
"computed": false,
7777
"shorthand": false,
7878
"value": {
79-
"type": "AssignmentExpression",
79+
"type": "AssignmentPattern",
8080
"start": 26,
8181
"end": 29,
82-
"operator": "=",
8382
"left": {
8483
"type": "Identifier",
8584
"start": 26,
@@ -107,13 +106,12 @@
107106
"end": 33,
108107
"name": "f"
109108
},
110-
"computed": true,
109+
"computed": false,
111110
"shorthand": false,
112111
"value": {
113-
"type": "AssignmentExpression",
112+
"type": "AssignmentPattern",
114113
"start": 35,
115114
"end": 38,
116-
"operator": "=",
117115
"left": {
118116
"type": "Identifier",
119117
"start": 35,
@@ -131,36 +129,21 @@
131129
"kind": "init"
132130
},
133131
{
134-
"type": "Property",
132+
"type": "AssignmentPattern",
135133
"start": 40,
136134
"end": 43,
137-
"method": false,
138-
"key": {
135+
"left": {
139136
"type": "Identifier",
140137
"start": 40,
141138
"end": 41,
142139
"name": "h"
143140
},
144-
"computed": false,
145-
"shorthand": true,
146-
"value": {
147-
"type": "AssignmentPattern",
148-
"start": 40,
141+
"right": {
142+
"type": "Identifier",
143+
"start": 42,
149144
"end": 43,
150-
"left": {
151-
"type": "Identifier",
152-
"start": 40,
153-
"end": 41,
154-
"name": "h"
155-
},
156-
"right": {
157-
"type": "Identifier",
158-
"start": 42,
159-
"end": 43,
160-
"name": "i"
161-
}
162-
},
163-
"kind": "init"
145+
"name": "i"
146+
}
164147
}
165148
]
166149
}

‎tools/babel/esprima/es2015-array-pattern/with-object-pattern/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"end": 9,
2121
"elements": [
2222
{
23-
"type": "ObjectExpression",
23+
"type": "ObjectPattern",
2424
"start": 5,
2525
"end": 8,
2626
"properties": [

‎tools/babel/esprima/es2015-object-pattern/nested/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"computed": false,
3434
"shorthand": false,
3535
"value": {
36-
"type": "ObjectExpression",
36+
"type": "ObjectPattern",
3737
"start": 7,
3838
"end": 9,
3939
"properties": []

‎tools/babel/esprima/es2015-object-pattern/properties/output.jam.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
"computed": false,
127127
"shorthand": false,
128128
"value": {
129-
"type": "ArrayExpression",
129+
"type": "ArrayPattern",
130130
"start": 25,
131131
"end": 28,
132132
"elements": [

0 commit comments

Comments
 (0)
Please sign in to comment.