[rust] ESTree representation with basic serialization support
Start of an `estree` crate for representing ESTree with serialization to/from ESTree JSON. To get the serialization to work quickly I took some shortcuts and uses a slightly less precise modeling. Longer-term we can write some custom serialization code and get more precise types (eg avoid the `ExpressionLike` enum in favor of proper Expression and ExpressionOrFoo types).
Joe Savona committed
Jul 6, 2023 at 09:24 UTC
4230eb63d8e05709b09eb6dc4d2923b71a01a257
6 files changed
+6415
compiler/forget/crates/estree/Cargo.toml
new
+12
@@ -0,0 +1,12 @@
1
+[package]
2
+name = "estree"
3
+version = "0.1.0"
4
+edition = "2021"
5
+
6
+# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
7
+
8
+[dependencies]
9
+bumpalo = { version = "3.13.0", features = ["boxed", "collections"] }
10
+elsa = "1.8.1"
11
+serde = { version = "1.0.164", features = ["derive"] }
12
+serde_json = "1.0.99"
compiler/forget/crates/estree/src/for-statement.json
new
+528
@@ -0,0 +1,528 @@
1
+{
2
+ "type": "Program",
3
+ "loc": {
4
+ "source": null,
5
+ "start": {
6
+ "line": 1,
7
+ "column": 0
8
+ },
9
+ "end": {
10
+ "line": 7,
11
+ "column": 1
12
+ }
13
+ },
14
+ "body": [
15
+ {
16
+ "type": "FunctionDeclaration",
17
+ "loc": {
18
+ "source": null,
19
+ "start": {
20
+ "line": 1,
21
+ "column": 0
22
+ },
23
+ "end": {
24
+ "line": 7,
25
+ "column": 1
26
+ }
27
+ },
28
+ "id": {
29
+ "type": "Identifier",
30
+ "loc": {
31
+ "source": null,
32
+ "start": {
33
+ "line": 1,
34
+ "column": 9
35
+ },
36
+ "end": {
37
+ "line": 1,
38
+ "column": 18
39
+ }
40
+ },
41
+ "name": "Component",
42
+ "typeAnnotation": null,
43
+ "optional": false,
44
+ "range": [
45
+ 9,
46
+ 18
47
+ ]
48
+ },
49
+ "params": [
50
+ {
51
+ "type": "Identifier",
52
+ "loc": {
53
+ "source": null,
54
+ "start": {
55
+ "line": 1,
56
+ "column": 19
57
+ },
58
+ "end": {
59
+ "line": 1,
60
+ "column": 24
61
+ }
62
+ },
63
+ "name": "props",
64
+ "typeAnnotation": null,
65
+ "optional": false,
66
+ "range": [
67
+ 19,
68
+ 24
69
+ ]
70
+ }
71
+ ],
72
+ "body": {
73
+ "type": "BlockStatement",
74
+ "loc": {
75
+ "source": null,
76
+ "start": {
77
+ "line": 1,
78
+ "column": 26
79
+ },
80
+ "end": {
81
+ "line": 7,
82
+ "column": 1
83
+ }
84
+ },
85
+ "body": [
86
+ {
87
+ "type": "VariableDeclaration",
88
+ "loc": {
89
+ "source": null,
90
+ "start": {
91
+ "line": 2,
92
+ "column": 2
93
+ },
94
+ "end": {
95
+ "line": 2,
96
+ "column": 12
97
+ }
98
+ },
99
+ "kind": "let",
100
+ "declarations": [
101
+ {
102
+ "type": "VariableDeclarator",
103
+ "loc": {
104
+ "source": null,
105
+ "start": {
106
+ "line": 2,
107
+ "column": 6
108
+ },
109
+ "end": {
110
+ "line": 2,
111
+ "column": 11
112
+ }
113
+ },
114
+ "init": {
115
+ "type": "Literal",
116
+ "loc": {
117
+ "source": null,
118
+ "start": {
119
+ "line": 2,
120
+ "column": 10
121
+ },
122
+ "end": {
123
+ "line": 2,
124
+ "column": 11
125
+ }
126
+ },
127
+ "value": 0,
128
+ "range": [
129
+ 38,
130
+ 39
131
+ ],
132
+ "raw": "0"
133
+ },
134
+ "id": {
135
+ "type": "Identifier",
136
+ "loc": {
137
+ "source": null,
138
+ "start": {
139
+ "line": 2,
140
+ "column": 6
141
+ },
142
+ "end": {
143
+ "line": 2,
144
+ "column": 7
145
+ }
146
+ },
147
+ "name": "x",
148
+ "typeAnnotation": null,
149
+ "optional": false,
150
+ "range": [
151
+ 34,
152
+ 35
153
+ ]
154
+ },
155
+ "range": [
156
+ 34,
157
+ 39
158
+ ]
159
+ }
160
+ ],
161
+ "range": [
162
+ 30,
163
+ 40
164
+ ]
165
+ },
166
+ {
167
+ "type": "ForStatement",
168
+ "loc": {
169
+ "source": null,
170
+ "start": {
171
+ "line": 3,
172
+ "column": 2
173
+ },
174
+ "end": {
175
+ "line": 5,
176
+ "column": 3
177
+ }
178
+ },
179
+ "init": {
180
+ "type": "VariableDeclaration",
181
+ "loc": {
182
+ "source": null,
183
+ "start": {
184
+ "line": 3,
185
+ "column": 7
186
+ },
187
+ "end": {
188
+ "line": 3,
189
+ "column": 16
190
+ }
191
+ },
192
+ "kind": "let",
193
+ "declarations": [
194
+ {
195
+ "type": "VariableDeclarator",
196
+ "loc": {
197
+ "source": null,
198
+ "start": {
199
+ "line": 3,
200
+ "column": 11
201
+ },
202
+ "end": {
203
+ "line": 3,
204
+ "column": 16
205
+ }
206
+ },
207
+ "init": {
208
+ "type": "Literal",
209
+ "loc": {
210
+ "source": null,
211
+ "start": {
212
+ "line": 3,
213
+ "column": 15
214
+ },
215
+ "end": {
216
+ "line": 3,
217
+ "column": 16
218
+ }
219
+ },
220
+ "value": 0,
221
+ "range": [
222
+ 56,
223
+ 57
224
+ ],
225
+ "raw": "0"
226
+ },
227
+ "id": {
228
+ "type": "Identifier",
229
+ "loc": {
230
+ "source": null,
231
+ "start": {
232
+ "line": 3,
233
+ "column": 11
234
+ },
235
+ "end": {
236
+ "line": 3,
237
+ "column": 12
238
+ }
239
+ },
240
+ "name": "i",
241
+ "typeAnnotation": null,
242
+ "optional": false,
243
+ "range": [
244
+ 52,
245
+ 53
246
+ ]
247
+ },
248
+ "range": [
249
+ 52,
250
+ 57
251
+ ]
252
+ }
253
+ ],
254
+ "range": [
255
+ 48,
256
+ 57
257
+ ]
258
+ },
259
+ "test": {
260
+ "type": "BinaryExpression",
261
+ "loc": {
262
+ "source": null,
263
+ "start": {
264
+ "line": 3,
265
+ "column": 18
266
+ },
267
+ "end": {
268
+ "line": 3,
269
+ "column": 24
270
+ }
271
+ },
272
+ "left": {
273
+ "type": "Identifier",
274
+ "loc": {
275
+ "source": null,
276
+ "start": {
277
+ "line": 3,
278
+ "column": 18
279
+ },
280
+ "end": {
281
+ "line": 3,
282
+ "column": 19
283
+ }
284
+ },
285
+ "name": "i",
286
+ "typeAnnotation": null,
287
+ "optional": false,
288
+ "range": [
289
+ 59,
290
+ 60
291
+ ]
292
+ },
293
+ "right": {
294
+ "type": "Literal",
295
+ "loc": {
296
+ "source": null,
297
+ "start": {
298
+ "line": 3,
299
+ "column": 22
300
+ },
301
+ "end": {
302
+ "line": 3,
303
+ "column": 24
304
+ }
305
+ },
306
+ "value": 10,
307
+ "range": [
308
+ 63,
309
+ 65
310
+ ],
311
+ "raw": "10"
312
+ },
313
+ "operator": "<",
314
+ "range": [
315
+ 59,
316
+ 65
317
+ ]
318
+ },
319
+ "update": {
320
+ "type": "UpdateExpression",
321
+ "loc": {
322
+ "source": null,
323
+ "start": {
324
+ "line": 3,
325
+ "column": 26
326
+ },
327
+ "end": {
328
+ "line": 3,
329
+ "column": 29
330
+ }
331
+ },
332
+ "operator": "++",
333
+ "argument": {
334
+ "type": "Identifier",
335
+ "loc": {
336
+ "source": null,
337
+ "start": {
338
+ "line": 3,
339
+ "column": 26
340
+ },
341
+ "end": {
342
+ "line": 3,
343
+ "column": 27
344
+ }
345
+ },
346
+ "name": "i",
347
+ "typeAnnotation": null,
348
+ "optional": false,
349
+ "range": [
350
+ 67,
351
+ 68
352
+ ]
353
+ },
354
+ "prefix": false,
355
+ "range": [
356
+ 67,
357
+ 70
358
+ ]
359
+ },
360
+ "body": {
361
+ "type": "BlockStatement",
362
+ "loc": {
363
+ "source": null,
364
+ "start": {
365
+ "line": 3,
366
+ "column": 31
367
+ },
368
+ "end": {
369
+ "line": 5,
370
+ "column": 3
371
+ }
372
+ },
373
+ "body": [
374
+ {
375
+ "type": "ExpressionStatement",
376
+ "loc": {
377
+ "source": null,
378
+ "start": {
379
+ "line": 4,
380
+ "column": 4
381
+ },
382
+ "end": {
383
+ "line": 4,
384
+ "column": 11
385
+ }
386
+ },
387
+ "expression": {
388
+ "type": "AssignmentExpression",
389
+ "loc": {
390
+ "source": null,
391
+ "start": {
392
+ "line": 4,
393
+ "column": 4
394
+ },
395
+ "end": {
396
+ "line": 4,
397
+ "column": 10
398
+ }
399
+ },
400
+ "operator": "+=",
401
+ "left": {
402
+ "type": "Identifier",
403
+ "loc": {
404
+ "source": null,
405
+ "start": {
406
+ "line": 4,
407
+ "column": 4
408
+ },
409
+ "end": {
410
+ "line": 4,
411
+ "column": 5
412
+ }
413
+ },
414
+ "name": "x",
415
+ "typeAnnotation": null,
416
+ "optional": false,
417
+ "range": [
418
+ 78,
419
+ 79
420
+ ]
421
+ },
422
+ "right": {
423
+ "type": "Identifier",
424
+ "loc": {
425
+ "source": null,
426
+ "start": {
427
+ "line": 4,
428
+ "column": 9
429
+ },
430
+ "end": {
431
+ "line": 4,
432
+ "column": 10
433
+ }
434
+ },
435
+ "name": "i",
436
+ "typeAnnotation": null,
437
+ "optional": false,
438
+ "range": [
439
+ 83,
440
+ 84
441
+ ]
442
+ },
443
+ "range": [
444
+ 78,
445
+ 84
446
+ ]
447
+ },
448
+ "directive": null,
449
+ "range": [
450
+ 78,
451
+ 85
452
+ ]
453
+ }
454
+ ],
455
+ "range": [
456
+ 72,
457
+ 89
458
+ ]
459
+ },
460
+ "range": [
461
+ 43,
462
+ 89
463
+ ]
464
+ },
465
+ {
466
+ "type": "ReturnStatement",
467
+ "loc": {
468
+ "source": null,
469
+ "start": {
470
+ "line": 6,
471
+ "column": 2
472
+ },
473
+ "end": {
474
+ "line": 6,
475
+ "column": 11
476
+ }
477
+ },
478
+ "argument": {
479
+ "type": "Identifier",
480
+ "loc": {
481
+ "source": null,
482
+ "start": {
483
+ "line": 6,
484
+ "column": 9
485
+ },
486
+ "end": {
487
+ "line": 6,
488
+ "column": 10
489
+ }
490
+ },
491
+ "name": "x",
492
+ "typeAnnotation": null,
493
+ "optional": false,
494
+ "range": [
495
+ 99,
496
+ 100
497
+ ]
498
+ },
499
+ "range": [
500
+ 92,
501
+ 101
502
+ ]
503
+ }
504
+ ],
505
+ "range": [
506
+ 26,
507
+ 103
508
+ ]
509
+ },
510
+ "typeParameters": null,
511
+ "returnType": null,
512
+ "predicate": null,
513
+ "generator": false,
514
+ "async": false,
515
+ "range": [
516
+ 0,
517
+ 103
518
+ ]
519
+ }
520
+ ],
521
+ "comments": [],
522
+ "interpreter": null,
523
+ "range": [
524
+ 0,
525
+ 103
526
+ ],
527
+ "sourceType": "script"
528
+ }
\ No newline at end of file
compiler/forget/crates/estree/src/kitchen-sink.json
new
+4069
@@ -0,0 +1,4069 @@
1
+{
2
+ "type": "Program",
3
+ "loc": {
4
+ "source": null,
5
+ "start": {
6
+ "line": 2,
7
+ "column": 0
8
+ },
9
+ "end": {
10
+ "line": 45,
11
+ "column": 1
12
+ }
13
+ },
14
+ "body": [
15
+ {
16
+ "type": "FunctionDeclaration",
17
+ "loc": {
18
+ "source": null,
19
+ "start": {
20
+ "line": 2,
21
+ "column": 0
22
+ },
23
+ "end": {
24
+ "line": 45,
25
+ "column": 1
26
+ }
27
+ },
28
+ "id": {
29
+ "type": "Identifier",
30
+ "loc": {
31
+ "source": null,
32
+ "start": {
33
+ "line": 2,
34
+ "column": 9
35
+ },
36
+ "end": {
37
+ "line": 2,
38
+ "column": 12
39
+ }
40
+ },
41
+ "name": "foo",
42
+ "typeAnnotation": null,
43
+ "optional": false,
44
+ "range": [
45
+ 10,
46
+ 13
47
+ ]
48
+ },
49
+ "params": [
50
+ {
51
+ "type": "ArrayPattern",
52
+ "loc": {
53
+ "source": null,
54
+ "start": {
55
+ "line": 2,
56
+ "column": 13
57
+ },
58
+ "end": {
59
+ "line": 2,
60
+ "column": 19
61
+ }
62
+ },
63
+ "elements": [
64
+ {
65
+ "type": "Identifier",
66
+ "loc": {
67
+ "source": null,
68
+ "start": {
69
+ "line": 2,
70
+ "column": 14
71
+ },
72
+ "end": {
73
+ "line": 2,
74
+ "column": 15
75
+ }
76
+ },
77
+ "name": "a",
78
+ "typeAnnotation": null,
79
+ "optional": false,
80
+ "range": [
81
+ 15,
82
+ 16
83
+ ]
84
+ },
85
+ {
86
+ "type": "Identifier",
87
+ "loc": {
88
+ "source": null,
89
+ "start": {
90
+ "line": 2,
91
+ "column": 17
92
+ },
93
+ "end": {
94
+ "line": 2,
95
+ "column": 18
96
+ }
97
+ },
98
+ "name": "b",
99
+ "typeAnnotation": null,
100
+ "optional": false,
101
+ "range": [
102
+ 18,
103
+ 19
104
+ ]
105
+ }
106
+ ],
107
+ "typeAnnotation": null,
108
+ "range": [
109
+ 14,
110
+ 20
111
+ ]
112
+ },
113
+ {
114
+ "type": "ObjectPattern",
115
+ "loc": {
116
+ "source": null,
117
+ "start": {
118
+ "line": 2,
119
+ "column": 21
120
+ },
121
+ "end": {
122
+ "line": 2,
123
+ "column": 38
124
+ }
125
+ },
126
+ "properties": [
127
+ {
128
+ "type": "Property",
129
+ "loc": {
130
+ "source": null,
131
+ "start": {
132
+ "line": 2,
133
+ "column": 23
134
+ },
135
+ "end": {
136
+ "line": 2,
137
+ "column": 24
138
+ }
139
+ },
140
+ "key": {
141
+ "type": "Identifier",
142
+ "loc": {
143
+ "source": null,
144
+ "start": {
145
+ "line": 2,
146
+ "column": 23
147
+ },
148
+ "end": {
149
+ "line": 2,
150
+ "column": 24
151
+ }
152
+ },
153
+ "name": "c",
154
+ "typeAnnotation": null,
155
+ "optional": false,
156
+ "range": [
157
+ 24,
158
+ 25
159
+ ]
160
+ },
161
+ "value": {
162
+ "type": "Identifier",
163
+ "loc": {
164
+ "source": null,
165
+ "start": {
166
+ "line": 2,
167
+ "column": 23
168
+ },
169
+ "end": {
170
+ "line": 2,
171
+ "column": 24
172
+ }
173
+ },
174
+ "name": "c",
175
+ "typeAnnotation": null,
176
+ "optional": false,
177
+ "range": [
178
+ 24,
179
+ 25
180
+ ]
181
+ },
182
+ "kind": "init",
183
+ "computed": false,
184
+ "method": false,
185
+ "shorthand": true,
186
+ "range": [
187
+ 24,
188
+ 25
189
+ ]
190
+ },
191
+ {
192
+ "type": "Property",
193
+ "loc": {
194
+ "source": null,
195
+ "start": {
196
+ "line": 2,
197
+ "column": 26
198
+ },
199
+ "end": {
200
+ "line": 2,
201
+ "column": 27
202
+ }
203
+ },
204
+ "key": {
205
+ "type": "Identifier",
206
+ "loc": {
207
+ "source": null,
208
+ "start": {
209
+ "line": 2,
210
+ "column": 26
211
+ },
212
+ "end": {
213
+ "line": 2,
214
+ "column": 27
215
+ }
216
+ },
217
+ "name": "d",
218
+ "typeAnnotation": null,
219
+ "optional": false,
220
+ "range": [
221
+ 27,
222
+ 28
223
+ ]
224
+ },
225
+ "value": {
226
+ "type": "Identifier",
227
+ "loc": {
228
+ "source": null,
229
+ "start": {
230
+ "line": 2,
231
+ "column": 26
232
+ },
233
+ "end": {
234
+ "line": 2,
235
+ "column": 27
236
+ }
237
+ },
238
+ "name": "d",
239
+ "typeAnnotation": null,
240
+ "optional": false,
241
+ "range": [
242
+ 27,
243
+ 28
244
+ ]
245
+ },
246
+ "kind": "init",
247
+ "computed": false,
248
+ "method": false,
249
+ "shorthand": true,
250
+ "range": [
251
+ 27,
252
+ 28
253
+ ]
254
+ },
255
+ {
256
+ "type": "Property",
257
+ "loc": {
258
+ "source": null,
259
+ "start": {
260
+ "line": 2,
261
+ "column": 29
262
+ },
263
+ "end": {
264
+ "line": 2,
265
+ "column": 36
266
+ }
267
+ },
268
+ "key": {
269
+ "type": "Identifier",
270
+ "loc": {
271
+ "source": null,
272
+ "start": {
273
+ "line": 2,
274
+ "column": 29
275
+ },
276
+ "end": {
277
+ "line": 2,
278
+ "column": 30
279
+ }
280
+ },
281
+ "name": "e",
282
+ "typeAnnotation": null,
283
+ "optional": false,
284
+ "range": [
285
+ 30,
286
+ 31
287
+ ]
288
+ },
289
+ "value": {
290
+ "type": "AssignmentPattern",
291
+ "loc": {
292
+ "source": null,
293
+ "start": {
294
+ "line": 2,
295
+ "column": 29
296
+ },
297
+ "end": {
298
+ "line": 2,
299
+ "column": 36
300
+ }
301
+ },
302
+ "left": {
303
+ "type": "Identifier",
304
+ "loc": {
305
+ "source": null,
306
+ "start": {
307
+ "line": 2,
308
+ "column": 29
309
+ },
310
+ "end": {
311
+ "line": 2,
312
+ "column": 30
313
+ }
314
+ },
315
+ "name": "e",
316
+ "typeAnnotation": null,
317
+ "optional": false,
318
+ "range": [
319
+ 30,
320
+ 31
321
+ ]
322
+ },
323
+ "right": {
324
+ "type": "Literal",
325
+ "loc": {
326
+ "source": null,
327
+ "start": {
328
+ "line": 2,
329
+ "column": 33
330
+ },
331
+ "end": {
332
+ "line": 2,
333
+ "column": 36
334
+ }
335
+ },
336
+ "value": "e",
337
+ "range": [
338
+ 34,
339
+ 37
340
+ ],
341
+ "raw": "\"e\""
342
+ },
343
+ "range": [
344
+ 30,
345
+ 37
346
+ ]
347
+ },
348
+ "kind": "init",
349
+ "computed": false,
350
+ "method": false,
351
+ "shorthand": true,
352
+ "range": [
353
+ 30,
354
+ 37
355
+ ]
356
+ }
357
+ ],
358
+ "typeAnnotation": null,
359
+ "range": [
360
+ 22,
361
+ 39
362
+ ]
363
+ },
364
+ {
365
+ "type": "AssignmentPattern",
366
+ "loc": {
367
+ "source": null,
368
+ "start": {
369
+ "line": 2,
370
+ "column": 40
371
+ },
372
+ "end": {
373
+ "line": 2,
374
+ "column": 47
375
+ }
376
+ },
377
+ "left": {
378
+ "type": "Identifier",
379
+ "loc": {
380
+ "source": null,
381
+ "start": {
382
+ "line": 2,
383
+ "column": 40
384
+ },
385
+ "end": {
386
+ "line": 2,
387
+ "column": 41
388
+ }
389
+ },
390
+ "name": "f",
391
+ "typeAnnotation": null,
392
+ "optional": false,
393
+ "range": [
394
+ 41,
395
+ 42
396
+ ]
397
+ },
398
+ "right": {
399
+ "type": "Literal",
400
+ "loc": {
401
+ "source": null,
402
+ "start": {
403
+ "line": 2,
404
+ "column": 44
405
+ },
406
+ "end": {
407
+ "line": 2,
408
+ "column": 47
409
+ }
410
+ },
411
+ "value": "f",
412
+ "range": [
413
+ 45,
414
+ 48
415
+ ],
416
+ "raw": "\"f\""
417
+ },
418
+ "range": [
419
+ 41,
420
+ 48
421
+ ]
422
+ },
423
+ {
424
+ "type": "RestElement",
425
+ "loc": {
426
+ "source": null,
427
+ "start": {
428
+ "line": 2,
429
+ "column": 49
430
+ },
431
+ "end": {
432
+ "line": 2,
433
+ "column": 56
434
+ }
435
+ },
436
+ "argument": {
437
+ "type": "Identifier",
438
+ "loc": {
439
+ "source": null,
440
+ "start": {
441
+ "line": 2,
442
+ "column": 52
443
+ },
444
+ "end": {
445
+ "line": 2,
446
+ "column": 56
447
+ }
448
+ },
449
+ "name": "args",
450
+ "typeAnnotation": null,
451
+ "optional": false,
452
+ "range": [
453
+ 53,
454
+ 57
455
+ ]
456
+ },
457
+ "range": [
458
+ 50,
459
+ 57
460
+ ]
461
+ }
462
+ ],
463
+ "body": {
464
+ "type": "BlockStatement",
465
+ "loc": {
466
+ "source": null,
467
+ "start": {
468
+ "line": 2,
469
+ "column": 58
470
+ },
471
+ "end": {
472
+ "line": 45,
473
+ "column": 1
474
+ }
475
+ },
476
+ "body": [
477
+ {
478
+ "type": "ExpressionStatement",
479
+ "loc": {
480
+ "source": null,
481
+ "start": {
482
+ "line": 3,
483
+ "column": 2
484
+ },
485
+ "end": {
486
+ "line": 3,
487
+ "column": 18
488
+ }
489
+ },
490
+ "expression": {
491
+ "type": "Literal",
492
+ "loc": {
493
+ "source": null,
494
+ "start": {
495
+ "line": 3,
496
+ "column": 2
497
+ },
498
+ "end": {
499
+ "line": 3,
500
+ "column": 18
501
+ }
502
+ },
503
+ "value": "use P780731197",
504
+ "range": [
505
+ 63,
506
+ 79
507
+ ],
508
+ "raw": "\"use P780731197\""
509
+ },
510
+ "directive": "use P780731197",
511
+ "range": [
512
+ 63,
513
+ 79
514
+ ]
515
+ },
516
+ {
517
+ "type": "VariableDeclaration",
518
+ "loc": {
519
+ "source": null,
520
+ "start": {
521
+ "line": 4,
522
+ "column": 2
523
+ },
524
+ "end": {
525
+ "line": 4,
526
+ "column": 12
527
+ }
528
+ },
529
+ "kind": "let",
530
+ "declarations": [
531
+ {
532
+ "type": "VariableDeclarator",
533
+ "loc": {
534
+ "source": null,
535
+ "start": {
536
+ "line": 4,
537
+ "column": 6
538
+ },
539
+ "end": {
540
+ "line": 4,
541
+ "column": 11
542
+ }
543
+ },
544
+ "init": {
545
+ "type": "Literal",
546
+ "loc": {
547
+ "source": null,
548
+ "start": {
549
+ "line": 4,
550
+ "column": 10
551
+ },
552
+ "end": {
553
+ "line": 4,
554
+ "column": 11
555
+ }
556
+ },
557
+ "value": 0,
558
+ "range": [
559
+ 90,
560
+ 91
561
+ ],
562
+ "raw": "0"
563
+ },
564
+ "id": {
565
+ "type": "Identifier",
566
+ "loc": {
567
+ "source": null,
568
+ "start": {
569
+ "line": 4,
570
+ "column": 6
571
+ },
572
+ "end": {
573
+ "line": 4,
574
+ "column": 7
575
+ }
576
+ },
577
+ "name": "i",
578
+ "typeAnnotation": null,
579
+ "optional": false,
580
+ "range": [
581
+ 86,
582
+ 87
583
+ ]
584
+ },
585
+ "range": [
586
+ 86,
587
+ 91
588
+ ]
589
+ }
590
+ ],
591
+ "range": [
592
+ 82,
593
+ 92
594
+ ]
595
+ },
596
+ {
597
+ "type": "VariableDeclaration",
598
+ "loc": {
599
+ "source": null,
600
+ "start": {
601
+ "line": 5,
602
+ "column": 2
603
+ },
604
+ "end": {
605
+ "line": 5,
606
+ "column": 13
607
+ }
608
+ },
609
+ "kind": "var",
610
+ "declarations": [
611
+ {
612
+ "type": "VariableDeclarator",
613
+ "loc": {
614
+ "source": null,
615
+ "start": {
616
+ "line": 5,
617
+ "column": 6
618
+ },
619
+ "end": {
620
+ "line": 5,
621
+ "column": 12
622
+ }
623
+ },
624
+ "init": {
625
+ "type": "ArrayExpression",
626
+ "loc": {
627
+ "source": null,
628
+ "start": {
629
+ "line": 5,
630
+ "column": 10
631
+ },
632
+ "end": {
633
+ "line": 5,
634
+ "column": 12
635
+ }
636
+ },
637
+ "elements": [],
638
+ "trailingComma": false,
639
+ "range": [
640
+ 103,
641
+ 105
642
+ ]
643
+ },
644
+ "id": {
645
+ "type": "Identifier",
646
+ "loc": {
647
+ "source": null,
648
+ "start": {
649
+ "line": 5,
650
+ "column": 6
651
+ },
652
+ "end": {
653
+ "line": 5,
654
+ "column": 7
655
+ }
656
+ },
657
+ "name": "x",
658
+ "typeAnnotation": null,
659
+ "optional": false,
660
+ "range": [
661
+ 99,
662
+ 100
663
+ ]
664
+ },
665
+ "range": [
666
+ 99,
667
+ 105
668
+ ]
669
+ }
670
+ ],
671
+ "range": [
672
+ 95,
673
+ 106
674
+ ]
675
+ },
676
+ {
677
+ "type": "ClassDeclaration",
678
+ "loc": {
679
+ "source": null,
680
+ "start": {
681
+ "line": 7,
682
+ "column": 2
683
+ },
684
+ "end": {
685
+ "line": 12,
686
+ "column": 3
687
+ }
688
+ },
689
+ "id": {
690
+ "type": "Identifier",
691
+ "loc": {
692
+ "source": null,
693
+ "start": {
694
+ "line": 7,
695
+ "column": 8
696
+ },
697
+ "end": {
698
+ "line": 7,
699
+ "column": 11
700
+ }
701
+ },
702
+ "name": "Bar",
703
+ "typeAnnotation": null,
704
+ "optional": false,
705
+ "range": [
706
+ 116,
707
+ 119
708
+ ]
709
+ },
710
+ "typeParameters": null,
711
+ "superClass": null,
712
+ "superTypeParameters": null,
713
+ "implements": [],
714
+ "decorators": [],
715
+ "body": {
716
+ "type": "ClassBody",
717
+ "loc": {
718
+ "source": null,
719
+ "start": {
720
+ "line": 7,
721
+ "column": 12
722
+ },
723
+ "end": {
724
+ "line": 12,
725
+ "column": 3
726
+ }
727
+ },
728
+ "body": [
729
+ {
730
+ "type": "ClassProperty",
731
+ "loc": {
732
+ "source": null,
733
+ "start": {
734
+ "line": 8,
735
+ "column": 4
736
+ },
737
+ "end": {
738
+ "line": 8,
739
+ "column": 21
740
+ }
741
+ },
742
+ "key": {
743
+ "type": "Identifier",
744
+ "loc": {
745
+ "source": null,
746
+ "start": {
747
+ "line": 8,
748
+ "column": 4
749
+ },
750
+ "end": {
751
+ "line": 8,
752
+ "column": 15
753
+ }
754
+ },
755
+ "name": "secretSauce",
756
+ "typeAnnotation": null,
757
+ "optional": false,
758
+ "range": [
759
+ 126,
760
+ 137
761
+ ]
762
+ },
763
+ "value": {
764
+ "type": "Literal",
765
+ "loc": {
766
+ "source": null,
767
+ "start": {
768
+ "line": 8,
769
+ "column": 18
770
+ },
771
+ "end": {
772
+ "line": 8,
773
+ "column": 20
774
+ }
775
+ },
776
+ "value": 42,
777
+ "range": [
778
+ 140,
779
+ 142
780
+ ],
781
+ "raw": "42"
782
+ },
783
+ "computed": false,
784
+ "static": false,
785
+ "declare": false,
786
+ "optional": false,
787
+ "variance": null,
788
+ "typeAnnotation": null,
789
+ "range": [
790
+ 126,
791
+ 143
792
+ ]
793
+ },
794
+ {
795
+ "type": "MethodDefinition",
796
+ "loc": {
797
+ "source": null,
798
+ "start": {
799
+ "line": 9,
800
+ "column": 4
801
+ },
802
+ "end": {
803
+ "line": 11,
804
+ "column": 5
805
+ }
806
+ },
807
+ "key": {
808
+ "type": "Identifier",
809
+ "loc": {
810
+ "source": null,
811
+ "start": {
812
+ "line": 9,
813
+ "column": 4
814
+ },
815
+ "end": {
816
+ "line": 9,
817
+ "column": 15
818
+ }
819
+ },
820
+ "name": "constructor",
821
+ "typeAnnotation": null,
822
+ "optional": false,
823
+ "range": [
824
+ 148,
825
+ 159
826
+ ]
827
+ },
828
+ "value": {
829
+ "type": "FunctionExpression",
830
+ "loc": {
831
+ "source": null,
832
+ "start": {
833
+ "line": 9,
834
+ "column": 15
835
+ },
836
+ "end": {
837
+ "line": 11,
838
+ "column": 5
839
+ }
840
+ },
841
+ "id": null,
842
+ "params": [],
843
+ "body": {
844
+ "type": "BlockStatement",
845
+ "loc": {
846
+ "source": null,
847
+ "start": {
848
+ "line": 9,
849
+ "column": 18
850
+ },
851
+ "end": {
852
+ "line": 11,
853
+ "column": 5
854
+ }
855
+ },
856
+ "body": [
857
+ {
858
+ "type": "ExpressionStatement",
859
+ "loc": {
860
+ "source": null,
861
+ "start": {
862
+ "line": 10,
863
+ "column": 6
864
+ },
865
+ "end": {
866
+ "line": 10,
867
+ "column": 36
868
+ }
869
+ },
870
+ "expression": {
871
+ "type": "CallExpression",
872
+ "loc": {
873
+ "source": null,
874
+ "start": {
875
+ "line": 10,
876
+ "column": 6
877
+ },
878
+ "end": {
879
+ "line": 10,
880
+ "column": 35
881
+ }
882
+ },
883
+ "callee": {
884
+ "type": "MemberExpression",
885
+ "loc": {
886
+ "source": null,
887
+ "start": {
888
+ "line": 10,
889
+ "column": 6
890
+ },
891
+ "end": {
892
+ "line": 10,
893
+ "column": 17
894
+ }
895
+ },
896
+ "object": {
897
+ "type": "Identifier",
898
+ "loc": {
899
+ "source": null,
900
+ "start": {
901
+ "line": 10,
902
+ "column": 6
903
+ },
904
+ "end": {
905
+ "line": 10,
906
+ "column": 13
907
+ }
908
+ },
909
+ "name": "console",
910
+ "typeAnnotation": null,
911
+ "optional": false,
912
+ "range": [
913
+ 170,
914
+ 177
915
+ ]
916
+ },
917
+ "property": {
918
+ "type": "Identifier",
919
+ "loc": {
920
+ "source": null,
921
+ "start": {
922
+ "line": 10,
923
+ "column": 14
924
+ },
925
+ "end": {
926
+ "line": 10,
927
+ "column": 17
928
+ }
929
+ },
930
+ "name": "log",
931
+ "typeAnnotation": null,
932
+ "optional": false,
933
+ "range": [
934
+ 178,
935
+ 181
936
+ ]
937
+ },
938
+ "computed": false,
939
+ "range": [
940
+ 170,
941
+ 181
942
+ ]
943
+ },
944
+ "typeArguments": null,
945
+ "arguments": [
946
+ {
947
+ "type": "MemberExpression",
948
+ "loc": {
949
+ "source": null,
950
+ "start": {
951
+ "line": 10,
952
+ "column": 18
953
+ },
954
+ "end": {
955
+ "line": 10,
956
+ "column": 34
957
+ }
958
+ },
959
+ "object": {
960
+ "type": "ThisExpression",
961
+ "loc": {
962
+ "source": null,
963
+ "start": {
964
+ "line": 10,
965
+ "column": 18
966
+ },
967
+ "end": {
968
+ "line": 10,
969
+ "column": 22
970
+ }
971
+ },
972
+ "range": [
973
+ 182,
974
+ 186
975
+ ]
976
+ },
977
+ "property": {
978
+ "type": "Identifier",
979
+ "loc": {
980
+ "source": null,
981
+ "start": {
982
+ "line": 10,
983
+ "column": 23
984
+ },
985
+ "end": {
986
+ "line": 10,
987
+ "column": 34
988
+ }
989
+ },
990
+ "name": "secretSauce",
991
+ "typeAnnotation": null,
992
+ "optional": false,
993
+ "range": [
994
+ 187,
995
+ 198
996
+ ]
997
+ },
998
+ "computed": false,
999
+ "range": [
1000
+ 182,
1001
+ 198
1002
+ ]
1003
+ }
1004
+ ],
1005
+ "range": [
1006
+ 170,
1007
+ 199
1008
+ ]
1009
+ },
1010
+ "directive": null,
1011
+ "range": [
1012
+ 170,
1013
+ 200
1014
+ ]
1015
+ }
1016
+ ],
1017
+ "range": [
1018
+ 162,
1019
+ 206
1020
+ ]
1021
+ },
1022
+ "typeParameters": null,
1023
+ "returnType": null,
1024
+ "predicate": null,
1025
+ "generator": false,
1026
+ "async": false,
1027
+ "range": [
1028
+ 159,
1029
+ 206
1030
+ ]
1031
+ },
1032
+ "kind": "constructor",
1033
+ "computed": false,
1034
+ "static": false,
1035
+ "range": [
1036
+ 148,
1037
+ 206
1038
+ ]
1039
+ }
1040
+ ],
1041
+ "range": [
1042
+ 120,
1043
+ 210
1044
+ ]
1045
+ },
1046
+ "range": [
1047
+ 110,
1048
+ 210
1049
+ ]
1050
+ },
1051
+ {
1052
+ "type": "VariableDeclaration",
1053
+ "loc": {
1054
+ "source": null,
1055
+ "start": {
1056
+ "line": 14,
1057
+ "column": 2
1058
+ },
1059
+ "end": {
1060
+ "line": 14,
1061
+ "column": 42
1062
+ }
1063
+ },
1064
+ "kind": "const",
1065
+ "declarations": [
1066
+ {
1067
+ "type": "VariableDeclarator",
1068
+ "loc": {
1069
+ "source": null,
1070
+ "start": {
1071
+ "line": 14,
1072
+ "column": 8
1073
+ },
1074
+ "end": {
1075
+ "line": 14,
1076
+ "column": 41
1077
+ }
1078
+ },
1079
+ "init": {
1080
+ "type": "ObjectExpression",
1081
+ "loc": {
1082
+ "source": null,
1083
+ "start": {
1084
+ "line": 14,
1085
+ "column": 12
1086
+ },
1087
+ "end": {
1088
+ "line": 14,
1089
+ "column": 41
1090
+ }
1091
+ },
1092
+ "properties": [
1093
+ {
1094
+ "type": "SpreadElement",
1095
+ "loc": {
1096
+ "source": null,
1097
+ "start": {
1098
+ "line": 14,
1099
+ "column": 14
1100
+ },
1101
+ "end": {
1102
+ "line": 14,
1103
+ "column": 18
1104
+ }
1105
+ },
1106
+ "argument": {
1107
+ "type": "Identifier",
1108
+ "loc": {
1109
+ "source": null,
1110
+ "start": {
1111
+ "line": 14,
1112
+ "column": 17
1113
+ },
1114
+ "end": {
1115
+ "line": 14,
1116
+ "column": 18
1117
+ }
1118
+ },
1119
+ "name": "a",
1120
+ "typeAnnotation": null,
1121
+ "optional": false,
1122
+ "range": [
1123
+ 229,
1124
+ 230
1125
+ ]
1126
+ },
1127
+ "range": [
1128
+ 226,
1129
+ 230
1130
+ ]
1131
+ },
1132
+ {
1133
+ "type": "Property",
1134
+ "loc": {
1135
+ "source": null,
1136
+ "start": {
1137
+ "line": 14,
1138
+ "column": 20
1139
+ },
1140
+ "end": {
1141
+ "line": 14,
1142
+ "column": 26
1143
+ }
1144
+ },
1145
+ "key": {
1146
+ "type": "Identifier",
1147
+ "loc": {
1148
+ "source": null,
1149
+ "start": {
1150
+ "line": 14,
1151
+ "column": 20
1152
+ },
1153
+ "end": {
1154
+ "line": 14,
1155
+ "column": 21
1156
+ }
1157
+ },
1158
+ "name": "b",
1159
+ "typeAnnotation": null,
1160
+ "optional": false,
1161
+ "range": [
1162
+ 232,
1163
+ 233
1164
+ ]
1165
+ },
1166
+ "value": {
1167
+ "type": "FunctionExpression",
1168
+ "loc": {
1169
+ "source": null,
1170
+ "start": {
1171
+ "line": 14,
1172
+ "column": 20
1173
+ },
1174
+ "end": {
1175
+ "line": 14,
1176
+ "column": 26
1177
+ }
1178
+ },
1179
+ "id": null,
1180
+ "params": [],
1181
+ "body": {
1182
+ "type": "BlockStatement",
1183
+ "loc": {
1184
+ "source": null,
1185
+ "start": {
1186
+ "line": 14,
1187
+ "column": 24
1188
+ },
1189
+ "end": {
1190
+ "line": 14,
1191
+ "column": 26
1192
+ }
1193
+ },
1194
+ "body": [],
1195
+ "range": [
1196
+ 236,
1197
+ 238
1198
+ ]
1199
+ },
1200
+ "typeParameters": null,
1201
+ "returnType": null,
1202
+ "predicate": null,
1203
+ "generator": false,
1204
+ "async": false,
1205
+ "range": [
1206
+ 232,
1207
+ 238
1208
+ ]
1209
+ },
1210
+ "kind": "init",
1211
+ "computed": false,
1212
+ "method": true,
1213
+ "shorthand": false,
1214
+ "range": [
1215
+ 232,
1216
+ 238
1217
+ ]
1218
+ },
1219
+ {
1220
+ "type": "Property",
1221
+ "loc": {
1222
+ "source": null,
1223
+ "start": {
1224
+ "line": 14,
1225
+ "column": 28
1226
+ },
1227
+ "end": {
1228
+ "line": 14,
1229
+ "column": 39
1230
+ }
1231
+ },
1232
+ "key": {
1233
+ "type": "Identifier",
1234
+ "loc": {
1235
+ "source": null,
1236
+ "start": {
1237
+ "line": 14,
1238
+ "column": 28
1239
+ },
1240
+ "end": {
1241
+ "line": 14,
1242
+ "column": 29
1243
+ }
1244
+ },
1245
+ "name": "c",
1246
+ "typeAnnotation": null,
1247
+ "optional": false,
1248
+ "range": [
1249
+ 240,
1250
+ 241
1251
+ ]
1252
+ },
1253
+ "value": {
1254
+ "type": "ArrowFunctionExpression",
1255
+ "loc": {
1256
+ "source": null,
1257
+ "start": {
1258
+ "line": 14,
1259
+ "column": 31
1260
+ },
1261
+ "end": {
1262
+ "line": 14,
1263
+ "column": 39
1264
+ }
1265
+ },
1266
+ "id": null,
1267
+ "params": [],
1268
+ "body": {
1269
+ "type": "BlockStatement",
1270
+ "loc": {
1271
+ "source": null,
1272
+ "start": {
1273
+ "line": 14,
1274
+ "column": 37
1275
+ },
1276
+ "end": {
1277
+ "line": 14,
1278
+ "column": 39
1279
+ }
1280
+ },
1281
+ "body": [],
1282
+ "range": [
1283
+ 249,
1284
+ 251
1285
+ ]
1286
+ },
1287
+ "typeParameters": null,
1288
+ "returnType": null,
1289
+ "predicate": null,
1290
+ "expression": false,
1291
+ "async": false,
1292
+ "range": [
1293
+ 243,
1294
+ 251
1295
+ ]
1296
+ },
1297
+ "kind": "init",
1298
+ "computed": false,
1299
+ "method": false,
1300
+ "shorthand": false,
1301
+ "range": [
1302
+ 240,
1303
+ 251
1304
+ ]
1305
+ }
1306
+ ],
1307
+ "range": [
1308
+ 224,
1309
+ 253
1310
+ ]
1311
+ },
1312
+ "id": {
1313
+ "type": "Identifier",
1314
+ "loc": {
1315
+ "source": null,
1316
+ "start": {
1317
+ "line": 14,
1318
+ "column": 8
1319
+ },
1320
+ "end": {
1321
+ "line": 14,
1322
+ "column": 9
1323
+ }
1324
+ },
1325
+ "name": "g",
1326
+ "typeAnnotation": null,
1327
+ "optional": false,
1328
+ "range": [
1329
+ 220,
1330
+ 221
1331
+ ]
1332
+ },
1333
+ "range": [
1334
+ 220,
1335
+ 253
1336
+ ]
1337
+ }
1338
+ ],
1339
+ "range": [
1340
+ 214,
1341
+ 254
1342
+ ]
1343
+ },
1344
+ {
1345
+ "type": "VariableDeclaration",
1346
+ "loc": {
1347
+ "source": null,
1348
+ "start": {
1349
+ "line": 15,
1350
+ "column": 2
1351
+ },
1352
+ "end": {
1353
+ "line": 15,
1354
+ "column": 19
1355
+ }
1356
+ },
1357
+ "kind": "const",
1358
+ "declarations": [
1359
+ {
1360
+ "type": "VariableDeclarator",
1361
+ "loc": {
1362
+ "source": null,
1363
+ "start": {
1364
+ "line": 15,
1365
+ "column": 8
1366
+ },
1367
+ "end": {
1368
+ "line": 15,
1369
+ "column": 18
1370
+ }
1371
+ },
1372
+ "init": {
1373
+ "type": "ArrayExpression",
1374
+ "loc": {
1375
+ "source": null,
1376
+ "start": {
1377
+ "line": 15,
1378
+ "column": 12
1379
+ },
1380
+ "end": {
1381
+ "line": 15,
1382
+ "column": 18
1383
+ }
1384
+ },
1385
+ "elements": [
1386
+ {
1387
+ "type": "SpreadElement",
1388
+ "loc": {
1389
+ "source": null,
1390
+ "start": {
1391
+ "line": 15,
1392
+ "column": 13
1393
+ },
1394
+ "end": {
1395
+ "line": 15,
1396
+ "column": 17
1397
+ }
1398
+ },
1399
+ "argument": {
1400
+ "type": "Identifier",
1401
+ "loc": {
1402
+ "source": null,
1403
+ "start": {
1404
+ "line": 15,
1405
+ "column": 16
1406
+ },
1407
+ "end": {
1408
+ "line": 15,
1409
+ "column": 17
1410
+ }
1411
+ },
1412
+ "name": "b",
1413
+ "typeAnnotation": null,
1414
+ "optional": false,
1415
+ "range": [
1416
+ 271,
1417
+ 272
1418
+ ]
1419
+ },
1420
+ "range": [
1421
+ 268,
1422
+ 272
1423
+ ]
1424
+ }
1425
+ ],
1426
+ "trailingComma": false,
1427
+ "range": [
1428
+ 267,
1429
+ 273
1430
+ ]
1431
+ },
1432
+ "id": {
1433
+ "type": "Identifier",
1434
+ "loc": {
1435
+ "source": null,
1436
+ "start": {
1437
+ "line": 15,
1438
+ "column": 8
1439
+ },
1440
+ "end": {
1441
+ "line": 15,
1442
+ "column": 9
1443
+ }
1444
+ },
1445
+ "name": "h",
1446
+ "typeAnnotation": null,
1447
+ "optional": false,
1448
+ "range": [
1449
+ 263,
1450
+ 264
1451
+ ]
1452
+ },
1453
+ "range": [
1454
+ 263,
1455
+ 273
1456
+ ]
1457
+ }
1458
+ ],
1459
+ "range": [
1460
+ 257,
1461
+ 274
1462
+ ]
1463
+ },
1464
+ {
1465
+ "type": "ExpressionStatement",
1466
+ "loc": {
1467
+ "source": null,
1468
+ "start": {
1469
+ "line": 16,
1470
+ "column": 2
1471
+ },
1472
+ "end": {
1473
+ "line": 16,
1474
+ "column": 17
1475
+ }
1476
+ },
1477
+ "expression": {
1478
+ "type": "NewExpression",
1479
+ "loc": {
1480
+ "source": null,
1481
+ "start": {
1482
+ "line": 16,
1483
+ "column": 2
1484
+ },
1485
+ "end": {
1486
+ "line": 16,
1487
+ "column": 16
1488
+ }
1489
+ },
1490
+ "callee": {
1491
+ "type": "Identifier",
1492
+ "loc": {
1493
+ "source": null,
1494
+ "start": {
1495
+ "line": 16,
1496
+ "column": 6
1497
+ },
1498
+ "end": {
1499
+ "line": 16,
1500
+ "column": 7
1501
+ }
1502
+ },
1503
+ "name": "c",
1504
+ "typeAnnotation": null,
1505
+ "optional": false,
1506
+ "range": [
1507
+ 281,
1508
+ 282
1509
+ ]
1510
+ },
1511
+ "typeArguments": null,
1512
+ "arguments": [
1513
+ {
1514
+ "type": "SpreadElement",
1515
+ "loc": {
1516
+ "source": null,
1517
+ "start": {
1518
+ "line": 16,
1519
+ "column": 8
1520
+ },
1521
+ "end": {
1522
+ "line": 16,
1523
+ "column": 15
1524
+ }
1525
+ },
1526
+ "argument": {
1527
+ "type": "Identifier",
1528
+ "loc": {
1529
+ "source": null,
1530
+ "start": {
1531
+ "line": 16,
1532
+ "column": 11
1533
+ },
1534
+ "end": {
1535
+ "line": 16,
1536
+ "column": 15
1537
+ }
1538
+ },
1539
+ "name": "args",
1540
+ "typeAnnotation": null,
1541
+ "optional": false,
1542
+ "range": [
1543
+ 286,
1544
+ 290
1545
+ ]
1546
+ },
1547
+ "range": [
1548
+ 283,
1549
+ 290
1550
+ ]
1551
+ }
1552
+ ],
1553
+ "range": [
1554
+ 277,
1555
+ 291
1556
+ ]
1557
+ },
1558
+ "directive": null,
1559
+ "range": [
1560
+ 277,
1561
+ 292
1562
+ ]
1563
+ },
1564
+ {
1565
+ "type": "ExpressionStatement",
1566
+ "loc": {
1567
+ "source": null,
1568
+ "start": {
1569
+ "line": 17,
1570
+ "column": 2
1571
+ },
1572
+ "end": {
1573
+ "line": 17,
1574
+ "column": 13
1575
+ }
1576
+ },
1577
+ "expression": {
1578
+ "type": "CallExpression",
1579
+ "loc": {
1580
+ "source": null,
1581
+ "start": {
1582
+ "line": 17,
1583
+ "column": 2
1584
+ },
1585
+ "end": {
1586
+ "line": 17,
1587
+ "column": 12
1588
+ }
1589
+ },
1590
+ "callee": {
1591
+ "type": "Identifier",
1592
+ "loc": {
1593
+ "source": null,
1594
+ "start": {
1595
+ "line": 17,
1596
+ "column": 2
1597
+ },
1598
+ "end": {
1599
+ "line": 17,
1600
+ "column": 3
1601
+ }
1602
+ },
1603
+ "name": "c",
1604
+ "typeAnnotation": null,
1605
+ "optional": false,
1606
+ "range": [
1607
+ 295,
1608
+ 296
1609
+ ]
1610
+ },
1611
+ "typeArguments": null,
1612
+ "arguments": [
1613
+ {
1614
+ "type": "SpreadElement",
1615
+ "loc": {
1616
+ "source": null,
1617
+ "start": {
1618
+ "line": 17,
1619
+ "column": 4
1620
+ },
1621
+ "end": {
1622
+ "line": 17,
1623
+ "column": 11
1624
+ }
1625
+ },
1626
+ "argument": {
1627
+ "type": "Identifier",
1628
+ "loc": {
1629
+ "source": null,
1630
+ "start": {
1631
+ "line": 17,
1632
+ "column": 7
1633
+ },
1634
+ "end": {
1635
+ "line": 17,
1636
+ "column": 11
1637
+ }
1638
+ },
1639
+ "name": "args",
1640
+ "typeAnnotation": null,
1641
+ "optional": false,
1642
+ "range": [
1643
+ 300,
1644
+ 304
1645
+ ]
1646
+ },
1647
+ "range": [
1648
+ 297,
1649
+ 304
1650
+ ]
1651
+ }
1652
+ ],
1653
+ "range": [
1654
+ 295,
1655
+ 305
1656
+ ]
1657
+ },
1658
+ "directive": null,
1659
+ "range": [
1660
+ 295,
1661
+ 306
1662
+ ]
1663
+ },
1664
+ {
1665
+ "type": "ExpressionStatement",
1666
+ "loc": {
1667
+ "source": null,
1668
+ "start": {
1669
+ "line": 18,
1670
+ "column": 2
1671
+ },
1672
+ "end": {
1673
+ "line": 18,
1674
+ "column": 14
1675
+ }
1676
+ },
1677
+ "expression": {
1678
+ "type": "AssignmentExpression",
1679
+ "loc": {
1680
+ "source": null,
1681
+ "start": {
1682
+ "line": 18,
1683
+ "column": 2
1684
+ },
1685
+ "end": {
1686
+ "line": 18,
1687
+ "column": 13
1688
+ }
1689
+ },
1690
+ "operator": "+=",
1691
+ "left": {
1692
+ "type": "MemberExpression",
1693
+ "loc": {
1694
+ "source": null,
1695
+ "start": {
1696
+ "line": 18,
1697
+ "column": 2
1698
+ },
1699
+ "end": {
1700
+ "line": 18,
1701
+ "column": 8
1702
+ }
1703
+ },
1704
+ "object": {
1705
+ "type": "Identifier",
1706
+ "loc": {
1707
+ "source": null,
1708
+ "start": {
1709
+ "line": 18,
1710
+ "column": 2
1711
+ },
1712
+ "end": {
1713
+ "line": 18,
1714
+ "column": 3
1715
+ }
1716
+ },
1717
+ "name": "g",
1718
+ "typeAnnotation": null,
1719
+ "optional": false,
1720
+ "range": [
1721
+ 309,
1722
+ 310
1723
+ ]
1724
+ },
1725
+ "property": {
1726
+ "type": "Literal",
1727
+ "loc": {
1728
+ "source": null,
1729
+ "start": {
1730
+ "line": 18,
1731
+ "column": 4
1732
+ },
1733
+ "end": {
1734
+ "line": 18,
1735
+ "column": 7
1736
+ }
1737
+ },
1738
+ "value": "e",
1739
+ "range": [
1740
+ 311,
1741
+ 314
1742
+ ],
1743
+ "raw": "\"e\""
1744
+ },
1745
+ "computed": true,
1746
+ "range": [
1747
+ 309,
1748
+ 315
1749
+ ]
1750
+ },
1751
+ "right": {
1752
+ "type": "Literal",
1753
+ "loc": {
1754
+ "source": null,
1755
+ "start": {
1756
+ "line": 18,
1757
+ "column": 12
1758
+ },
1759
+ "end": {
1760
+ "line": 18,
1761
+ "column": 13
1762
+ }
1763
+ },
1764
+ "value": 1,
1765
+ "range": [
1766
+ 319,
1767
+ 320
1768
+ ],
1769
+ "raw": "1"
1770
+ },
1771
+ "range": [
1772
+ 309,
1773
+ 320
1774
+ ]
1775
+ },
1776
+ "directive": null,
1777
+ "range": [
1778
+ 309,
1779
+ 321
1780
+ ]
1781
+ },
1782
+ {
1783
+ "type": "VariableDeclaration",
1784
+ "loc": {
1785
+ "source": null,
1786
+ "start": {
1787
+ "line": 19,
1788
+ "column": 2
1789
+ },
1790
+ "end": {
1791
+ "line": 19,
1792
+ "column": 33
1793
+ }
1794
+ },
1795
+ "kind": "const",
1796
+ "declarations": [
1797
+ {
1798
+ "type": "VariableDeclarator",
1799
+ "loc": {
1800
+ "source": null,
1801
+ "start": {
1802
+ "line": 19,
1803
+ "column": 8
1804
+ },
1805
+ "end": {
1806
+ "line": 19,
1807
+ "column": 32
1808
+ }
1809
+ },
1810
+ "init": {
1811
+ "type": "CallExpression",
1812
+ "loc": {
1813
+ "source": null,
1814
+ "start": {
1815
+ "line": 19,
1816
+ "column": 21
1817
+ },
1818
+ "end": {
1819
+ "line": 19,
1820
+ "column": 32
1821
+ }
1822
+ },
1823
+ "callee": {
1824
+ "type": "Identifier",
1825
+ "loc": {
1826
+ "source": null,
1827
+ "start": {
1828
+ "line": 19,
1829
+ "column": 21
1830
+ },
1831
+ "end": {
1832
+ "line": 19,
1833
+ "column": 29
1834
+ }
1835
+ },
1836
+ "name": "useState",
1837
+ "typeAnnotation": null,
1838
+ "optional": false,
1839
+ "range": [
1840
+ 343,
1841
+ 351
1842
+ ]
1843
+ },
1844
+ "typeArguments": null,
1845
+ "arguments": [
1846
+ {
1847
+ "type": "Literal",
1848
+ "loc": {
1849
+ "source": null,
1850
+ "start": {
1851
+ "line": 19,
1852
+ "column": 30
1853
+ },
1854
+ "end": {
1855
+ "line": 19,
1856
+ "column": 31
1857
+ }
1858
+ },
1859
+ "value": 0,
1860
+ "range": [
1861
+ 352,
1862
+ 353
1863
+ ],
1864
+ "raw": "0"
1865
+ }
1866
+ ],
1867
+ "range": [
1868
+ 343,
1869
+ 354
1870
+ ]
1871
+ },
1872
+ "id": {
1873
+ "type": "ArrayPattern",
1874
+ "loc": {
1875
+ "source": null,
1876
+ "start": {
1877
+ "line": 19,
1878
+ "column": 8
1879
+ },
1880
+ "end": {
1881
+ "line": 19,
1882
+ "column": 18
1883
+ }
1884
+ },
1885
+ "elements": [
1886
+ {
1887
+ "type": "Identifier",
1888
+ "loc": {
1889
+ "source": null,
1890
+ "start": {
1891
+ "line": 19,
1892
+ "column": 9
1893
+ },
1894
+ "end": {
1895
+ "line": 19,
1896
+ "column": 10
1897
+ }
1898
+ },
1899
+ "name": "y",
1900
+ "typeAnnotation": null,
1901
+ "optional": false,
1902
+ "range": [
1903
+ 331,
1904
+ 332
1905
+ ]
1906
+ },
1907
+ {
1908
+ "type": "RestElement",
1909
+ "loc": {
1910
+ "source": null,
1911
+ "start": {
1912
+ "line": 19,
1913
+ "column": 12
1914
+ },
1915
+ "end": {
1916
+ "line": 19,
1917
+ "column": 17
1918
+ }
1919
+ },
1920
+ "argument": {
1921
+ "type": "Identifier",
1922
+ "loc": {
1923
+ "source": null,
1924
+ "start": {
1925
+ "line": 19,
1926
+ "column": 15
1927
+ },
1928
+ "end": {
1929
+ "line": 19,
1930
+ "column": 17
1931
+ }
1932
+ },
1933
+ "name": "yy",
1934
+ "typeAnnotation": null,
1935
+ "optional": false,
1936
+ "range": [
1937
+ 337,
1938
+ 339
1939
+ ]
1940
+ },
1941
+ "range": [
1942
+ 334,
1943
+ 339
1944
+ ]
1945
+ }
1946
+ ],
1947
+ "typeAnnotation": null,
1948
+ "range": [
1949
+ 330,
1950
+ 340
1951
+ ]
1952
+ },
1953
+ "range": [
1954
+ 330,
1955
+ 354
1956
+ ]
1957
+ }
1958
+ ],
1959
+ "range": [
1960
+ 324,
1961
+ 355
1962
+ ]
1963
+ },
1964
+ {
1965
+ "type": "VariableDeclaration",
1966
+ "loc": {
1967
+ "source": null,
1968
+ "start": {
1969
+ "line": 20,
1970
+ "column": 2
1971
+ },
1972
+ "end": {
1973
+ "line": 20,
1974
+ "column": 46
1975
+ }
1976
+ },
1977
+ "kind": "const",
1978
+ "declarations": [
1979
+ {
1980
+ "type": "VariableDeclarator",
1981
+ "loc": {
1982
+ "source": null,
1983
+ "start": {
1984
+ "line": 20,
1985
+ "column": 8
1986
+ },
1987
+ "end": {
1988
+ "line": 20,
1989
+ "column": 45
1990
+ }
1991
+ },
1992
+ "init": {
1993
+ "type": "CallExpression",
1994
+ "loc": {
1995
+ "source": null,
1996
+ "start": {
1997
+ "line": 20,
1998
+ "column": 34
1999
+ },
2000
+ "end": {
2001
+ "line": 20,
2002
+ "column": 45
2003
+ }
2004
+ },
2005
+ "callee": {
2006
+ "type": "Identifier",
2007
+ "loc": {
2008
+ "source": null,
2009
+ "start": {
2010
+ "line": 20,
2011
+ "column": 34
2012
+ },
2013
+ "end": {
2014
+ "line": 20,
2015
+ "column": 43
2016
+ }
2017
+ },
2018
+ "name": "useCustom",
2019
+ "typeAnnotation": null,
2020
+ "optional": false,
2021
+ "range": [
2022
+ 390,
2023
+ 399
2024
+ ]
2025
+ },
2026
+ "typeArguments": null,
2027
+ "arguments": [],
2028
+ "range": [
2029
+ 390,
2030
+ 401
2031
+ ]
2032
+ },
2033
+ "id": {
2034
+ "type": "ObjectPattern",
2035
+ "loc": {
2036
+ "source": null,
2037
+ "start": {
2038
+ "line": 20,
2039
+ "column": 8
2040
+ },
2041
+ "end": {
2042
+ "line": 20,
2043
+ "column": 31
2044
+ }
2045
+ },
2046
+ "properties": [
2047
+ {
2048
+ "type": "Property",
2049
+ "loc": {
2050
+ "source": null,
2051
+ "start": {
2052
+ "line": 20,
2053
+ "column": 10
2054
+ },
2055
+ "end": {
2056
+ "line": 20,
2057
+ "column": 11
2058
+ }
2059
+ },
2060
+ "key": {
2061
+ "type": "Identifier",
2062
+ "loc": {
2063
+ "source": null,
2064
+ "start": {
2065
+ "line": 20,
2066
+ "column": 10
2067
+ },
2068
+ "end": {
2069
+ "line": 20,
2070
+ "column": 11
2071
+ }
2072
+ },
2073
+ "name": "z",
2074
+ "typeAnnotation": null,
2075
+ "optional": false,
2076
+ "range": [
2077
+ 366,
2078
+ 367
2079
+ ]
2080
+ },
2081
+ "value": {
2082
+ "type": "Identifier",
2083
+ "loc": {
2084
+ "source": null,
2085
+ "start": {
2086
+ "line": 20,
2087
+ "column": 10
2088
+ },
2089
+ "end": {
2090
+ "line": 20,
2091
+ "column": 11
2092
+ }
2093
+ },
2094
+ "name": "z",
2095
+ "typeAnnotation": null,
2096
+ "optional": false,
2097
+ "range": [
2098
+ 366,
2099
+ 367
2100
+ ]
2101
+ },
2102
+ "kind": "init",
2103
+ "computed": false,
2104
+ "method": false,
2105
+ "shorthand": true,
2106
+ "range": [
2107
+ 366,
2108
+ 367
2109
+ ]
2110
+ },
2111
+ {
2112
+ "type": "Property",
2113
+ "loc": {
2114
+ "source": null,
2115
+ "start": {
2116
+ "line": 20,
2117
+ "column": 13
2118
+ },
2119
+ "end": {
2120
+ "line": 20,
2121
+ "column": 22
2122
+ }
2123
+ },
2124
+ "key": {
2125
+ "type": "Identifier",
2126
+ "loc": {
2127
+ "source": null,
2128
+ "start": {
2129
+ "line": 20,
2130
+ "column": 13
2131
+ },
2132
+ "end": {
2133
+ "line": 20,
2134
+ "column": 15
2135
+ }
2136
+ },
2137
+ "name": "aa",
2138
+ "typeAnnotation": null,
2139
+ "optional": false,
2140
+ "range": [
2141
+ 369,
2142
+ 371
2143
+ ]
2144
+ },
2145
+ "value": {
2146
+ "type": "AssignmentPattern",
2147
+ "loc": {
2148
+ "source": null,
2149
+ "start": {
2150
+ "line": 20,
2151
+ "column": 13
2152
+ },
2153
+ "end": {
2154
+ "line": 20,
2155
+ "column": 22
2156
+ }
2157
+ },
2158
+ "left": {
2159
+ "type": "Identifier",
2160
+ "loc": {
2161
+ "source": null,
2162
+ "start": {
2163
+ "line": 20,
2164
+ "column": 13
2165
+ },
2166
+ "end": {
2167
+ "line": 20,
2168
+ "column": 15
2169
+ }
2170
+ },
2171
+ "name": "aa",
2172
+ "typeAnnotation": null,
2173
+ "optional": false,
2174
+ "range": [
2175
+ 369,
2176
+ 371
2177
+ ]
2178
+ },
2179
+ "right": {
2180
+ "type": "Literal",
2181
+ "loc": {
2182
+ "source": null,
2183
+ "start": {
2184
+ "line": 20,
2185
+ "column": 18
2186
+ },
2187
+ "end": {
2188
+ "line": 20,
2189
+ "column": 22
2190
+ }
2191
+ },
2192
+ "value": "aa",
2193
+ "range": [
2194
+ 374,
2195
+ 378
2196
+ ],
2197
+ "raw": "\"aa\""
2198
+ },
2199
+ "range": [
2200
+ 369,
2201
+ 378
2202
+ ]
2203
+ },
2204
+ "kind": "init",
2205
+ "computed": false,
2206
+ "method": false,
2207
+ "shorthand": true,
2208
+ "range": [
2209
+ 369,
2210
+ 378
2211
+ ]
2212
+ },
2213
+ {
2214
+ "type": "RestElement",
2215
+ "loc": {
2216
+ "source": null,
2217
+ "start": {
2218
+ "line": 20,
2219
+ "column": 24
2220
+ },
2221
+ "end": {
2222
+ "line": 20,
2223
+ "column": 29
2224
+ }
2225
+ },
2226
+ "argument": {
2227
+ "type": "Identifier",
2228
+ "loc": {
2229
+ "source": null,
2230
+ "start": {
2231
+ "line": 20,
2232
+ "column": 27
2233
+ },
2234
+ "end": {
2235
+ "line": 20,
2236
+ "column": 29
2237
+ }
2238
+ },
2239
+ "name": "zz",
2240
+ "typeAnnotation": null,
2241
+ "optional": false,
2242
+ "range": [
2243
+ 383,
2244
+ 385
2245
+ ]
2246
+ },
2247
+ "range": [
2248
+ 380,
2249
+ 385
2250
+ ]
2251
+ }
2252
+ ],
2253
+ "typeAnnotation": null,
2254
+ "range": [
2255
+ 364,
2256
+ 387
2257
+ ]
2258
+ },
2259
+ "range": [
2260
+ 364,
2261
+ 401
2262
+ ]
2263
+ }
2264
+ ],
2265
+ "range": [
2266
+ 358,
2267
+ 402
2268
+ ]
2269
+ },
2270
+ {
2271
+ "type": "ExpressionStatement",
2272
+ "loc": {
2273
+ "source": null,
2274
+ "start": {
2275
+ "line": 22,
2276
+ "column": 2
2277
+ },
2278
+ "end": {
2279
+ "line": 22,
2280
+ "column": 30
2281
+ }
2282
+ },
2283
+ "expression": {
2284
+ "type": "JSXElement",
2285
+ "loc": {
2286
+ "source": null,
2287
+ "start": {
2288
+ "line": 22,
2289
+ "column": 2
2290
+ },
2291
+ "end": {
2292
+ "line": 22,
2293
+ "column": 29
2294
+ }
2295
+ },
2296
+ "openingElement": {
2297
+ "type": "JSXOpeningElement",
2298
+ "loc": {
2299
+ "source": null,
2300
+ "start": {
2301
+ "line": 22,
2302
+ "column": 2
2303
+ },
2304
+ "end": {
2305
+ "line": 22,
2306
+ "column": 20
2307
+ }
2308
+ },
2309
+ "name": {
2310
+ "type": "JSXIdentifier",
2311
+ "loc": {
2312
+ "source": null,
2313
+ "start": {
2314
+ "line": 22,
2315
+ "column": 3
2316
+ },
2317
+ "end": {
2318
+ "line": 22,
2319
+ "column": 9
2320
+ }
2321
+ },
2322
+ "name": "Button",
2323
+ "range": [
2324
+ 407,
2325
+ 413
2326
+ ]
2327
+ },
2328
+ "attributes": [
2329
+ {
2330
+ "type": "JSXSpreadAttribute",
2331
+ "loc": {
2332
+ "source": null,
2333
+ "start": {
2334
+ "line": 22,
2335
+ "column": 10
2336
+ },
2337
+ "end": {
2338
+ "line": 22,
2339
+ "column": 19
2340
+ }
2341
+ },
2342
+ "argument": {
2343
+ "type": "Identifier",
2344
+ "loc": {
2345
+ "source": null,
2346
+ "start": {
2347
+ "line": 22,
2348
+ "column": 14
2349
+ },
2350
+ "end": {
2351
+ "line": 22,
2352
+ "column": 18
2353
+ }
2354
+ },
2355
+ "name": "args",
2356
+ "typeAnnotation": null,
2357
+ "optional": false,
2358
+ "range": [
2359
+ 418,
2360
+ 422
2361
+ ]
2362
+ },
2363
+ "range": [
2364
+ 414,
2365
+ 423
2366
+ ]
2367
+ }
2368
+ ],
2369
+ "selfClosing": false,
2370
+ "range": [
2371
+ 406,
2372
+ 424
2373
+ ]
2374
+ },
2375
+ "children": [],
2376
+ "closingElement": {
2377
+ "type": "JSXClosingElement",
2378
+ "loc": {
2379
+ "source": null,
2380
+ "start": {
2381
+ "line": 22,
2382
+ "column": 20
2383
+ },
2384
+ "end": {
2385
+ "line": 22,
2386
+ "column": 29
2387
+ }
2388
+ },
2389
+ "name": {
2390
+ "type": "JSXIdentifier",
2391
+ "loc": {
2392
+ "source": null,
2393
+ "start": {
2394
+ "line": 22,
2395
+ "column": 22
2396
+ },
2397
+ "end": {
2398
+ "line": 22,
2399
+ "column": 28
2400
+ }
2401
+ },
2402
+ "name": "Button",
2403
+ "range": [
2404
+ 426,
2405
+ 432
2406
+ ]
2407
+ },
2408
+ "range": [
2409
+ 424,
2410
+ 433
2411
+ ]
2412
+ },
2413
+ "range": [
2414
+ 406,
2415
+ 433
2416
+ ]
2417
+ },
2418
+ "directive": null,
2419
+ "range": [
2420
+ 406,
2421
+ 434
2422
+ ]
2423
+ },
2424
+ {
2425
+ "type": "ExpressionStatement",
2426
+ "loc": {
2427
+ "source": null,
2428
+ "start": {
2429
+ "line": 23,
2430
+ "column": 2
2431
+ },
2432
+ "end": {
2433
+ "line": 23,
2434
+ "column": 48
2435
+ }
2436
+ },
2437
+ "expression": {
2438
+ "type": "JSXElement",
2439
+ "loc": {
2440
+ "source": null,
2441
+ "start": {
2442
+ "line": 23,
2443
+ "column": 2
2444
+ },
2445
+ "end": {
2446
+ "line": 23,
2447
+ "column": 47
2448
+ }
2449
+ },
2450
+ "openingElement": {
2451
+ "type": "JSXOpeningElement",
2452
+ "loc": {
2453
+ "source": null,
2454
+ "start": {
2455
+ "line": 23,
2456
+ "column": 2
2457
+ },
2458
+ "end": {
2459
+ "line": 23,
2460
+ "column": 38
2461
+ }
2462
+ },
2463
+ "name": {
2464
+ "type": "JSXIdentifier",
2465
+ "loc": {
2466
+ "source": null,
2467
+ "start": {
2468
+ "line": 23,
2469
+ "column": 3
2470
+ },
2471
+ "end": {
2472
+ "line": 23,
2473
+ "column": 9
2474
+ }
2475
+ },
2476
+ "name": "Button",
2477
+ "range": [
2478
+ 438,
2479
+ 444
2480
+ ]
2481
+ },
2482
+ "attributes": [
2483
+ {
2484
+ "type": "JSXAttribute",
2485
+ "loc": {
2486
+ "source": null,
2487
+ "start": {
2488
+ "line": 23,
2489
+ "column": 10
2490
+ },
2491
+ "end": {
2492
+ "line": 23,
2493
+ "column": 37
2494
+ }
2495
+ },
2496
+ "name": {
2497
+ "type": "JSXNamespacedName",
2498
+ "loc": {
2499
+ "source": null,
2500
+ "start": {
2501
+ "line": 23,
2502
+ "column": 10
2503
+ },
2504
+ "end": {
2505
+ "line": 23,
2506
+ "column": 20
2507
+ }
2508
+ },
2509
+ "namespace": {
2510
+ "type": "JSXIdentifier",
2511
+ "loc": {
2512
+ "source": null,
2513
+ "start": {
2514
+ "line": 23,
2515
+ "column": 10
2516
+ },
2517
+ "end": {
2518
+ "line": 23,
2519
+ "column": 15
2520
+ }
2521
+ },
2522
+ "name": "xlink",
2523
+ "range": [
2524
+ 445,
2525
+ 450
2526
+ ]
2527
+ },
2528
+ "name": {
2529
+ "type": "JSXIdentifier",
2530
+ "loc": {
2531
+ "source": null,
2532
+ "start": {
2533
+ "line": 23,
2534
+ "column": 16
2535
+ },
2536
+ "end": {
2537
+ "line": 23,
2538
+ "column": 20
2539
+ }
2540
+ },
2541
+ "name": "href",
2542
+ "range": [
2543
+ 451,
2544
+ 455
2545
+ ]
2546
+ },
2547
+ "range": [
2548
+ 445,
2549
+ 455
2550
+ ]
2551
+ },
2552
+ "value": {
2553
+ "type": "Literal",
2554
+ "loc": {
2555
+ "source": null,
2556
+ "start": {
2557
+ "line": 23,
2558
+ "column": 21
2559
+ },
2560
+ "end": {
2561
+ "line": 23,
2562
+ "column": 37
2563
+ }
2564
+ },
2565
+ "value": "localhost:3000",
2566
+ "range": [
2567
+ 456,
2568
+ 472
2569
+ ],
2570
+ "raw": "\"localhost:3000\""
2571
+ },
2572
+ "range": [
2573
+ 445,
2574
+ 472
2575
+ ]
2576
+ }
2577
+ ],
2578
+ "selfClosing": false,
2579
+ "range": [
2580
+ 437,
2581
+ 473
2582
+ ]
2583
+ },
2584
+ "children": [],
2585
+ "closingElement": {
2586
+ "type": "JSXClosingElement",
2587
+ "loc": {
2588
+ "source": null,
2589
+ "start": {
2590
+ "line": 23,
2591
+ "column": 38
2592
+ },
2593
+ "end": {
2594
+ "line": 23,
2595
+ "column": 47
2596
+ }
2597
+ },
2598
+ "name": {
2599
+ "type": "JSXIdentifier",
2600
+ "loc": {
2601
+ "source": null,
2602
+ "start": {
2603
+ "line": 23,
2604
+ "column": 40
2605
+ },
2606
+ "end": {
2607
+ "line": 23,
2608
+ "column": 46
2609
+ }
2610
+ },
2611
+ "name": "Button",
2612
+ "range": [
2613
+ 475,
2614
+ 481
2615
+ ]
2616
+ },
2617
+ "range": [
2618
+ 473,
2619
+ 482
2620
+ ]
2621
+ },
2622
+ "range": [
2623
+ 437,
2624
+ 482
2625
+ ]
2626
+ },
2627
+ "directive": null,
2628
+ "range": [
2629
+ 437,
2630
+ 483
2631
+ ]
2632
+ },
2633
+ {
2634
+ "type": "ExpressionStatement",
2635
+ "loc": {
2636
+ "source": null,
2637
+ "start": {
2638
+ "line": 24,
2639
+ "column": 2
2640
+ },
2641
+ "end": {
2642
+ "line": 24,
2643
+ "column": 29
2644
+ }
2645
+ },
2646
+ "expression": {
2647
+ "type": "JSXElement",
2648
+ "loc": {
2649
+ "source": null,
2650
+ "start": {
2651
+ "line": 24,
2652
+ "column": 2
2653
+ },
2654
+ "end": {
2655
+ "line": 24,
2656
+ "column": 28
2657
+ }
2658
+ },
2659
+ "openingElement": {
2660
+ "type": "JSXOpeningElement",
2661
+ "loc": {
2662
+ "source": null,
2663
+ "start": {
2664
+ "line": 24,
2665
+ "column": 2
2666
+ },
2667
+ "end": {
2668
+ "line": 24,
2669
+ "column": 19
2670
+ }
2671
+ },
2672
+ "name": {
2673
+ "type": "JSXIdentifier",
2674
+ "loc": {
2675
+ "source": null,
2676
+ "start": {
2677
+ "line": 24,
2678
+ "column": 3
2679
+ },
2680
+ "end": {
2681
+ "line": 24,
2682
+ "column": 9
2683
+ }
2684
+ },
2685
+ "name": "Button",
2686
+ "range": [
2687
+ 487,
2688
+ 493
2689
+ ]
2690
+ },
2691
+ "attributes": [
2692
+ {
2693
+ "type": "JSXAttribute",
2694
+ "loc": {
2695
+ "source": null,
2696
+ "start": {
2697
+ "line": 24,
2698
+ "column": 10
2699
+ },
2700
+ "end": {
2701
+ "line": 24,
2702
+ "column": 18
2703
+ }
2704
+ },
2705
+ "name": {
2706
+ "type": "JSXIdentifier",
2707
+ "loc": {
2708
+ "source": null,
2709
+ "start": {
2710
+ "line": 24,
2711
+ "column": 10
2712
+ },
2713
+ "end": {
2714
+ "line": 24,
2715
+ "column": 14
2716
+ }
2717
+ },
2718
+ "name": "haha",
2719
+ "range": [
2720
+ 494,
2721
+ 498
2722
+ ]
2723
+ },
2724
+ "value": {
2725
+ "type": "JSXExpressionContainer",
2726
+ "loc": {
2727
+ "source": null,
2728
+ "start": {
2729
+ "line": 24,
2730
+ "column": 15
2731
+ },
2732
+ "end": {
2733
+ "line": 24,
2734
+ "column": 18
2735
+ }
2736
+ },
2737
+ "expression": {
2738
+ "type": "Literal",
2739
+ "loc": {
2740
+ "source": null,
2741
+ "start": {
2742
+ "line": 24,
2743
+ "column": 16
2744
+ },
2745
+ "end": {
2746
+ "line": 24,
2747
+ "column": 17
2748
+ }
2749
+ },
2750
+ "value": 1,
2751
+ "range": [
2752
+ 500,
2753
+ 501
2754
+ ],
2755
+ "raw": "1"
2756
+ },
2757
+ "range": [
2758
+ 499,
2759
+ 502
2760
+ ]
2761
+ },
2762
+ "range": [
2763
+ 494,
2764
+ 502
2765
+ ]
2766
+ }
2767
+ ],
2768
+ "selfClosing": false,
2769
+ "range": [
2770
+ 486,
2771
+ 503
2772
+ ]
2773
+ },
2774
+ "children": [],
2775
+ "closingElement": {
2776
+ "type": "JSXClosingElement",
2777
+ "loc": {
2778
+ "source": null,
2779
+ "start": {
2780
+ "line": 24,
2781
+ "column": 19
2782
+ },
2783
+ "end": {
2784
+ "line": 24,
2785
+ "column": 28
2786
+ }
2787
+ },
2788
+ "name": {
2789
+ "type": "JSXIdentifier",
2790
+ "loc": {
2791
+ "source": null,
2792
+ "start": {
2793
+ "line": 24,
2794
+ "column": 21
2795
+ },
2796
+ "end": {
2797
+ "line": 24,
2798
+ "column": 27
2799
+ }
2800
+ },
2801
+ "name": "Button",
2802
+ "range": [
2803
+ 505,
2804
+ 511
2805
+ ]
2806
+ },
2807
+ "range": [
2808
+ 503,
2809
+ 512
2810
+ ]
2811
+ },
2812
+ "range": [
2813
+ 486,
2814
+ 512
2815
+ ]
2816
+ },
2817
+ "directive": null,
2818
+ "range": [
2819
+ 486,
2820
+ 513
2821
+ ]
2822
+ },
2823
+ {
2824
+ "type": "ExpressionStatement",
2825
+ "loc": {
2826
+ "source": null,
2827
+ "start": {
2828
+ "line": 25,
2829
+ "column": 2
2830
+ },
2831
+ "end": {
2832
+ "line": 25,
2833
+ "column": 34
2834
+ }
2835
+ },
2836
+ "expression": {
2837
+ "type": "JSXElement",
2838
+ "loc": {
2839
+ "source": null,
2840
+ "start": {
2841
+ "line": 25,
2842
+ "column": 2
2843
+ },
2844
+ "end": {
2845
+ "line": 25,
2846
+ "column": 33
2847
+ }
2848
+ },
2849
+ "openingElement": {
2850
+ "type": "JSXOpeningElement",
2851
+ "loc": {
2852
+ "source": null,
2853
+ "start": {
2854
+ "line": 25,
2855
+ "column": 2
2856
+ },
2857
+ "end": {
2858
+ "line": 25,
2859
+ "column": 10
2860
+ }
2861
+ },
2862
+ "name": {
2863
+ "type": "JSXIdentifier",
2864
+ "loc": {
2865
+ "source": null,
2866
+ "start": {
2867
+ "line": 25,
2868
+ "column": 3
2869
+ },
2870
+ "end": {
2871
+ "line": 25,
2872
+ "column": 9
2873
+ }
2874
+ },
2875
+ "name": "Button",
2876
+ "range": [
2877
+ 517,
2878
+ 523
2879
+ ]
2880
+ },
2881
+ "attributes": [],
2882
+ "selfClosing": false,
2883
+ "range": [
2884
+ 516,
2885
+ 524
2886
+ ]
2887
+ },
2888
+ "children": [
2889
+ {
2890
+ "type": "JSXExpressionContainer",
2891
+ "loc": {
2892
+ "source": null,
2893
+ "start": {
2894
+ "line": 25,
2895
+ "column": 10
2896
+ },
2897
+ "end": {
2898
+ "line": 25,
2899
+ "column": 24
2900
+ }
2901
+ },
2902
+ "expression": {
2903
+ "type": "JSXEmptyExpression",
2904
+ "loc": {
2905
+ "source": null,
2906
+ "start": {
2907
+ "line": 25,
2908
+ "column": 11
2909
+ },
2910
+ "end": {
2911
+ "line": 25,
2912
+ "column": 23
2913
+ }
2914
+ },
2915
+ "range": [
2916
+ 525,
2917
+ 537
2918
+ ]
2919
+ },
2920
+ "range": [
2921
+ 524,
2922
+ 538
2923
+ ]
2924
+ }
2925
+ ],
2926
+ "closingElement": {
2927
+ "type": "JSXClosingElement",
2928
+ "loc": {
2929
+ "source": null,
2930
+ "start": {
2931
+ "line": 25,
2932
+ "column": 24
2933
+ },
2934
+ "end": {
2935
+ "line": 25,
2936
+ "column": 33
2937
+ }
2938
+ },
2939
+ "name": {
2940
+ "type": "JSXIdentifier",
2941
+ "loc": {
2942
+ "source": null,
2943
+ "start": {
2944
+ "line": 25,
2945
+ "column": 26
2946
+ },
2947
+ "end": {
2948
+ "line": 25,
2949
+ "column": 32
2950
+ }
2951
+ },
2952
+ "name": "Button",
2953
+ "range": [
2954
+ 540,
2955
+ 546
2956
+ ]
2957
+ },
2958
+ "range": [
2959
+ 538,
2960
+ 547
2961
+ ]
2962
+ },
2963
+ "range": [
2964
+ 516,
2965
+ 547
2966
+ ]
2967
+ },
2968
+ "directive": null,
2969
+ "range": [
2970
+ 516,
2971
+ 548
2972
+ ]
2973
+ },
2974
+ {
2975
+ "type": "ExpressionStatement",
2976
+ "loc": {
2977
+ "source": null,
2978
+ "start": {
2979
+ "line": 26,
2980
+ "column": 2
2981
+ },
2982
+ "end": {
2983
+ "line": 26,
2984
+ "column": 26
2985
+ }
2986
+ },
2987
+ "expression": {
2988
+ "type": "JSXElement",
2989
+ "loc": {
2990
+ "source": null,
2991
+ "start": {
2992
+ "line": 26,
2993
+ "column": 2
2994
+ },
2995
+ "end": {
2996
+ "line": 26,
2997
+ "column": 25
2998
+ }
2999
+ },
3000
+ "openingElement": {
3001
+ "type": "JSXOpeningElement",
3002
+ "loc": {
3003
+ "source": null,
3004
+ "start": {
3005
+ "line": 26,
3006
+ "column": 2
3007
+ },
3008
+ "end": {
3009
+ "line": 26,
3010
+ "column": 25
3011
+ }
3012
+ },
3013
+ "name": {
3014
+ "type": "JSXMemberExpression",
3015
+ "loc": {
3016
+ "source": null,
3017
+ "start": {
3018
+ "line": 26,
3019
+ "column": 3
3020
+ },
3021
+ "end": {
3022
+ "line": 26,
3023
+ "column": 22
3024
+ }
3025
+ },
3026
+ "object": {
3027
+ "type": "JSXIdentifier",
3028
+ "loc": {
3029
+ "source": null,
3030
+ "start": {
3031
+ "line": 26,
3032
+ "column": 3
3033
+ },
3034
+ "end": {
3035
+ "line": 26,
3036
+ "column": 15
3037
+ }
3038
+ },
3039
+ "name": "DesignSystem",
3040
+ "range": [
3041
+ 552,
3042
+ 564
3043
+ ]
3044
+ },
3045
+ "property": {
3046
+ "type": "JSXIdentifier",
3047
+ "loc": {
3048
+ "source": null,
3049
+ "start": {
3050
+ "line": 26,
3051
+ "column": 16
3052
+ },
3053
+ "end": {
3054
+ "line": 26,
3055
+ "column": 22
3056
+ }
3057
+ },
3058
+ "name": "Button",
3059
+ "range": [
3060
+ 565,
3061
+ 571
3062
+ ]
3063
+ },
3064
+ "range": [
3065
+ 552,
3066
+ 571
3067
+ ]
3068
+ },
3069
+ "attributes": [],
3070
+ "selfClosing": true,
3071
+ "range": [
3072
+ 551,
3073
+ 574
3074
+ ]
3075
+ },
3076
+ "children": [],
3077
+ "closingElement": null,
3078
+ "range": [
3079
+ 551,
3080
+ 574
3081
+ ]
3082
+ },
3083
+ "directive": null,
3084
+ "range": [
3085
+ 551,
3086
+ 575
3087
+ ]
3088
+ },
3089
+ {
3090
+ "type": "VariableDeclaration",
3091
+ "loc": {
3092
+ "source": null,
3093
+ "start": {
3094
+ "line": 28,
3095
+ "column": 2
3096
+ },
3097
+ "end": {
3098
+ "line": 28,
3099
+ "column": 49
3100
+ }
3101
+ },
3102
+ "kind": "const",
3103
+ "declarations": [
3104
+ {
3105
+ "type": "VariableDeclarator",
3106
+ "loc": {
3107
+ "source": null,
3108
+ "start": {
3109
+ "line": 28,
3110
+ "column": 8
3111
+ },
3112
+ "end": {
3113
+ "line": 28,
3114
+ "column": 48
3115
+ }
3116
+ },
3117
+ "init": {
3118
+ "type": "FunctionExpression",
3119
+ "loc": {
3120
+ "source": null,
3121
+ "start": {
3122
+ "line": 28,
3123
+ "column": 12
3124
+ },
3125
+ "end": {
3126
+ "line": 28,
3127
+ "column": 48
3128
+ }
3129
+ },
3130
+ "id": {
3131
+ "type": "Identifier",
3132
+ "loc": {
3133
+ "source": null,
3134
+ "start": {
3135
+ "line": 28,
3136
+ "column": 21
3137
+ },
3138
+ "end": {
3139
+ "line": 28,
3140
+ "column": 24
3141
+ }
3142
+ },
3143
+ "name": "bar",
3144
+ "typeAnnotation": null,
3145
+ "optional": false,
3146
+ "range": [
3147
+ 598,
3148
+ 601
3149
+ ]
3150
+ },
3151
+ "params": [
3152
+ {
3153
+ "type": "ArrayPattern",
3154
+ "loc": {
3155
+ "source": null,
3156
+ "start": {
3157
+ "line": 28,
3158
+ "column": 25
3159
+ },
3160
+ "end": {
3161
+ "line": 28,
3162
+ "column": 35
3163
+ }
3164
+ },
3165
+ "elements": [
3166
+ {
3167
+ "type": "Identifier",
3168
+ "loc": {
3169
+ "source": null,
3170
+ "start": {
3171
+ "line": 28,
3172
+ "column": 26
3173
+ },
3174
+ "end": {
3175
+ "line": 28,
3176
+ "column": 29
3177
+ }
3178
+ },
3179
+ "name": "quz",
3180
+ "typeAnnotation": null,
3181
+ "optional": false,
3182
+ "range": [
3183
+ 603,
3184
+ 606
3185
+ ]
3186
+ },
3187
+ {
3188
+ "type": "Identifier",
3189
+ "loc": {
3190
+ "source": null,
3191
+ "start": {
3192
+ "line": 28,
3193
+ "column": 31
3194
+ },
3195
+ "end": {
3196
+ "line": 28,
3197
+ "column": 34
3198
+ }
3199
+ },
3200
+ "name": "qux",
3201
+ "typeAnnotation": null,
3202
+ "optional": false,
3203
+ "range": [
3204
+ 608,
3205
+ 611
3206
+ ]
3207
+ }
3208
+ ],
3209
+ "typeAnnotation": null,
3210
+ "range": [
3211
+ 602,
3212
+ 612
3213
+ ]
3214
+ },
3215
+ {
3216
+ "type": "RestElement",
3217
+ "loc": {
3218
+ "source": null,
3219
+ "start": {
3220
+ "line": 28,
3221
+ "column": 37
3222
+ },
3223
+ "end": {
3224
+ "line": 28,
3225
+ "column": 44
3226
+ }
3227
+ },
3228
+ "argument": {
3229
+ "type": "Identifier",
3230
+ "loc": {
3231
+ "source": null,
3232
+ "start": {
3233
+ "line": 28,
3234
+ "column": 40
3235
+ },
3236
+ "end": {
3237
+ "line": 28,
3238
+ "column": 44
3239
+ }
3240
+ },
3241
+ "name": "args",
3242
+ "typeAnnotation": null,
3243
+ "optional": false,
3244
+ "range": [
3245
+ 617,
3246
+ 621
3247
+ ]
3248
+ },
3249
+ "range": [
3250
+ 614,
3251
+ 621
3252
+ ]
3253
+ }
3254
+ ],
3255
+ "body": {
3256
+ "type": "BlockStatement",
3257
+ "loc": {
3258
+ "source": null,
3259
+ "start": {
3260
+ "line": 28,
3261
+ "column": 46
3262
+ },
3263
+ "end": {
3264
+ "line": 28,
3265
+ "column": 48
3266
+ }
3267
+ },
3268
+ "body": [],
3269
+ "range": [
3270
+ 623,
3271
+ 625
3272
+ ]
3273
+ },
3274
+ "typeParameters": null,
3275
+ "returnType": null,
3276
+ "predicate": null,
3277
+ "generator": false,
3278
+ "async": false,
3279
+ "range": [
3280
+ 589,
3281
+ 625
3282
+ ]
3283
+ },
3284
+ "id": {
3285
+ "type": "Identifier",
3286
+ "loc": {
3287
+ "source": null,
3288
+ "start": {
3289
+ "line": 28,
3290
+ "column": 8
3291
+ },
3292
+ "end": {
3293
+ "line": 28,
3294
+ "column": 9
3295
+ }
3296
+ },
3297
+ "name": "j",
3298
+ "typeAnnotation": null,
3299
+ "optional": false,
3300
+ "range": [
3301
+ 585,
3302
+ 586
3303
+ ]
3304
+ },
3305
+ "range": [
3306
+ 585,
3307
+ 625
3308
+ ]
3309
+ }
3310
+ ],
3311
+ "range": [
3312
+ 579,
3313
+ 626
3314
+ ]
3315
+ },
3316
+ {
3317
+ "type": "ForStatement",
3318
+ "loc": {
3319
+ "source": null,
3320
+ "start": {
3321
+ "line": 30,
3322
+ "column": 2
3323
+ },
3324
+ "end": {
3325
+ "line": 32,
3326
+ "column": 3
3327
+ }
3328
+ },
3329
+ "init": null,
3330
+ "test": {
3331
+ "type": "BinaryExpression",
3332
+ "loc": {
3333
+ "source": null,
3334
+ "start": {
3335
+ "line": 30,
3336
+ "column": 9
3337
+ },
3338
+ "end": {
3339
+ "line": 30,
3340
+ "column": 14
3341
+ }
3342
+ },
3343
+ "left": {
3344
+ "type": "Identifier",
3345
+ "loc": {
3346
+ "source": null,
3347
+ "start": {
3348
+ "line": 30,
3349
+ "column": 9
3350
+ },
3351
+ "end": {
3352
+ "line": 30,
3353
+ "column": 10
3354
+ }
3355
+ },
3356
+ "name": "i",
3357
+ "typeAnnotation": null,
3358
+ "optional": false,
3359
+ "range": [
3360
+ 637,
3361
+ 638
3362
+ ]
3363
+ },
3364
+ "right": {
3365
+ "type": "Literal",
3366
+ "loc": {
3367
+ "source": null,
3368
+ "start": {
3369
+ "line": 30,
3370
+ "column": 13
3371
+ },
3372
+ "end": {
3373
+ "line": 30,
3374
+ "column": 14
3375
+ }
3376
+ },
3377
+ "value": 3,
3378
+ "range": [
3379
+ 641,
3380
+ 642
3381
+ ],
3382
+ "raw": "3"
3383
+ },
3384
+ "operator": "<",
3385
+ "range": [
3386
+ 637,
3387
+ 642
3388
+ ]
3389
+ },
3390
+ "update": {
3391
+ "type": "AssignmentExpression",
3392
+ "loc": {
3393
+ "source": null,
3394
+ "start": {
3395
+ "line": 30,
3396
+ "column": 16
3397
+ },
3398
+ "end": {
3399
+ "line": 30,
3400
+ "column": 22
3401
+ }
3402
+ },
3403
+ "operator": "+=",
3404
+ "left": {
3405
+ "type": "Identifier",
3406
+ "loc": {
3407
+ "source": null,
3408
+ "start": {
3409
+ "line": 30,
3410
+ "column": 16
3411
+ },
3412
+ "end": {
3413
+ "line": 30,
3414
+ "column": 17
3415
+ }
3416
+ },
3417
+ "name": "i",
3418
+ "typeAnnotation": null,
3419
+ "optional": false,
3420
+ "range": [
3421
+ 644,
3422
+ 645
3423
+ ]
3424
+ },
3425
+ "right": {
3426
+ "type": "Literal",
3427
+ "loc": {
3428
+ "source": null,
3429
+ "start": {
3430
+ "line": 30,
3431
+ "column": 21
3432
+ },
3433
+ "end": {
3434
+ "line": 30,
3435
+ "column": 22
3436
+ }
3437
+ },
3438
+ "value": 1,
3439
+ "range": [
3440
+ 649,
3441
+ 650
3442
+ ],
3443
+ "raw": "1"
3444
+ },
3445
+ "range": [
3446
+ 644,
3447
+ 650
3448
+ ]
3449
+ },
3450
+ "body": {
3451
+ "type": "BlockStatement",
3452
+ "loc": {
3453
+ "source": null,
3454
+ "start": {
3455
+ "line": 30,
3456
+ "column": 24
3457
+ },
3458
+ "end": {
3459
+ "line": 32,
3460
+ "column": 3
3461
+ }
3462
+ },
3463
+ "body": [
3464
+ {
3465
+ "type": "ExpressionStatement",
3466
+ "loc": {
3467
+ "source": null,
3468
+ "start": {
3469
+ "line": 31,
3470
+ "column": 4
3471
+ },
3472
+ "end": {
3473
+ "line": 31,
3474
+ "column": 14
3475
+ }
3476
+ },
3477
+ "expression": {
3478
+ "type": "CallExpression",
3479
+ "loc": {
3480
+ "source": null,
3481
+ "start": {
3482
+ "line": 31,
3483
+ "column": 4
3484
+ },
3485
+ "end": {
3486
+ "line": 31,
3487
+ "column": 13
3488
+ }
3489
+ },
3490
+ "callee": {
3491
+ "type": "MemberExpression",
3492
+ "loc": {
3493
+ "source": null,
3494
+ "start": {
3495
+ "line": 31,
3496
+ "column": 4
3497
+ },
3498
+ "end": {
3499
+ "line": 31,
3500
+ "column": 10
3501
+ }
3502
+ },
3503
+ "object": {
3504
+ "type": "Identifier",
3505
+ "loc": {
3506
+ "source": null,
3507
+ "start": {
3508
+ "line": 31,
3509
+ "column": 4
3510
+ },
3511
+ "end": {
3512
+ "line": 31,
3513
+ "column": 5
3514
+ }
3515
+ },
3516
+ "name": "x",
3517
+ "typeAnnotation": null,
3518
+ "optional": false,
3519
+ "range": [
3520
+ 658,
3521
+ 659
3522
+ ]
3523
+ },
3524
+ "property": {
3525
+ "type": "Identifier",
3526
+ "loc": {
3527
+ "source": null,
3528
+ "start": {
3529
+ "line": 31,
3530
+ "column": 6
3531
+ },
3532
+ "end": {
3533
+ "line": 31,
3534
+ "column": 10
3535
+ }
3536
+ },
3537
+ "name": "push",
3538
+ "typeAnnotation": null,
3539
+ "optional": false,
3540
+ "range": [
3541
+ 660,
3542
+ 664
3543
+ ]
3544
+ },
3545
+ "computed": false,
3546
+ "range": [
3547
+ 658,
3548
+ 664
3549
+ ]
3550
+ },
3551
+ "typeArguments": null,
3552
+ "arguments": [
3553
+ {
3554
+ "type": "Identifier",
3555
+ "loc": {
3556
+ "source": null,
3557
+ "start": {
3558
+ "line": 31,
3559
+ "column": 11
3560
+ },
3561
+ "end": {
3562
+ "line": 31,
3563
+ "column": 12
3564
+ }
3565
+ },
3566
+ "name": "i",
3567
+ "typeAnnotation": null,
3568
+ "optional": false,
3569
+ "range": [
3570
+ 665,
3571
+ 666
3572
+ ]
3573
+ }
3574
+ ],
3575
+ "range": [
3576
+ 658,
3577
+ 667
3578
+ ]
3579
+ },
3580
+ "directive": null,
3581
+ "range": [
3582
+ 658,
3583
+ 668
3584
+ ]
3585
+ }
3586
+ ],
3587
+ "range": [
3588
+ 652,
3589
+ 672
3590
+ ]
3591
+ },
3592
+ "range": [
3593
+ 630,
3594
+ 672
3595
+ ]
3596
+ },
3597
+ {
3598
+ "type": "ForStatement",
3599
+ "loc": {
3600
+ "source": null,
3601
+ "start": {
3602
+ "line": 33,
3603
+ "column": 2
3604
+ },
3605
+ "end": {
3606
+ "line": 35,
3607
+ "column": 3
3608
+ }
3609
+ },
3610
+ "init": null,
3611
+ "test": {
3612
+ "type": "BinaryExpression",
3613
+ "loc": {
3614
+ "source": null,
3615
+ "start": {
3616
+ "line": 33,
3617
+ "column": 9
3618
+ },
3619
+ "end": {
3620
+ "line": 33,
3621
+ "column": 14
3622
+ }
3623
+ },
3624
+ "left": {
3625
+ "type": "Identifier",
3626
+ "loc": {
3627
+ "source": null,
3628
+ "start": {
3629
+ "line": 33,
3630
+ "column": 9
3631
+ },
3632
+ "end": {
3633
+ "line": 33,
3634
+ "column": 10
3635
+ }
3636
+ },
3637
+ "name": "i",
3638
+ "typeAnnotation": null,
3639
+ "optional": false,
3640
+ "range": [
3641
+ 682,
3642
+ 683
3643
+ ]
3644
+ },
3645
+ "right": {
3646
+ "type": "Literal",
3647
+ "loc": {
3648
+ "source": null,
3649
+ "start": {
3650
+ "line": 33,
3651
+ "column": 13
3652
+ },
3653
+ "end": {
3654
+ "line": 33,
3655
+ "column": 14
3656
+ }
3657
+ },
3658
+ "value": 3,
3659
+ "range": [
3660
+ 686,
3661
+ 687
3662
+ ],
3663
+ "raw": "3"
3664
+ },
3665
+ "operator": "<",
3666
+ "range": [
3667
+ 682,
3668
+ 687
3669
+ ]
3670
+ },
3671
+ "update": null,
3672
+ "body": {
3673
+ "type": "BlockStatement",
3674
+ "loc": {
3675
+ "source": null,
3676
+ "start": {
3677
+ "line": 33,
3678
+ "column": 18
3679
+ },
3680
+ "end": {
3681
+ "line": 35,
3682
+ "column": 3
3683
+ }
3684
+ },
3685
+ "body": [
3686
+ {
3687
+ "type": "BreakStatement",
3688
+ "loc": {
3689
+ "source": null,
3690
+ "start": {
3691
+ "line": 34,
3692
+ "column": 4
3693
+ },
3694
+ "end": {
3695
+ "line": 34,
3696
+ "column": 10
3697
+ }
3698
+ },
3699
+ "label": null,
3700
+ "range": [
3701
+ 697,
3702
+ 703
3703
+ ]
3704
+ }
3705
+ ],
3706
+ "range": [
3707
+ 691,
3708
+ 707
3709
+ ]
3710
+ },
3711
+ "range": [
3712
+ 675,
3713
+ 707
3714
+ ]
3715
+ },
3716
+ {
3717
+ "type": "ForStatement",
3718
+ "loc": {
3719
+ "source": null,
3720
+ "start": {
3721
+ "line": 36,
3722
+ "column": 2
3723
+ },
3724
+ "end": {
3725
+ "line": 38,
3726
+ "column": 3
3727
+ }
3728
+ },
3729
+ "init": null,
3730
+ "test": null,
3731
+ "update": null,
3732
+ "body": {
3733
+ "type": "BlockStatement",
3734
+ "loc": {
3735
+ "source": null,
3736
+ "start": {
3737
+ "line": 36,
3738
+ "column": 11
3739
+ },
3740
+ "end": {
3741
+ "line": 38,
3742
+ "column": 3
3743
+ }
3744
+ },
3745
+ "body": [
3746
+ {
3747
+ "type": "BreakStatement",
3748
+ "loc": {
3749
+ "source": null,
3750
+ "start": {
3751
+ "line": 37,
3752
+ "column": 4
3753
+ },
3754
+ "end": {
3755
+ "line": 37,
3756
+ "column": 10
3757
+ }
3758
+ },
3759
+ "label": null,
3760
+ "range": [
3761
+ 725,
3762
+ 731
3763
+ ]
3764
+ }
3765
+ ],
3766
+ "range": [
3767
+ 719,
3768
+ 735
3769
+ ]
3770
+ },
3771
+ "range": [
3772
+ 710,
3773
+ 735
3774
+ ]
3775
+ },
3776
+ {
3777
+ "type": "ExpressionStatement",
3778
+ "loc": {
3779
+ "source": null,
3780
+ "start": {
3781
+ "line": 40,
3782
+ "column": 2
3783
+ },
3784
+ "end": {
3785
+ "line": 42,
3786
+ "column": 4
3787
+ }
3788
+ },
3789
+ "expression": {
3790
+ "type": "TaggedTemplateExpression",
3791
+ "loc": {
3792
+ "source": null,
3793
+ "start": {
3794
+ "line": 40,
3795
+ "column": 2
3796
+ },
3797
+ "end": {
3798
+ "line": 42,
3799
+ "column": 3
3800
+ }
3801
+ },
3802
+ "tag": {
3803
+ "type": "Identifier",
3804
+ "loc": {
3805
+ "source": null,
3806
+ "start": {
3807
+ "line": 40,
3808
+ "column": 2
3809
+ },
3810
+ "end": {
3811
+ "line": 40,
3812
+ "column": 9
3813
+ }
3814
+ },
3815
+ "name": "graphql",
3816
+ "typeAnnotation": null,
3817
+ "optional": false,
3818
+ "range": [
3819
+ 739,
3820
+ 746
3821
+ ]
3822
+ },
3823
+ "quasi": {
3824
+ "type": "TemplateLiteral",
3825
+ "loc": {
3826
+ "source": null,
3827
+ "start": {
3828
+ "line": 40,
3829
+ "column": 9
3830
+ },
3831
+ "end": {
3832
+ "line": 42,
3833
+ "column": 3
3834
+ }
3835
+ },
3836
+ "quasis": [
3837
+ {
3838
+ "type": "TemplateElement",
3839
+ "loc": {
3840
+ "source": null,
3841
+ "start": {
3842
+ "line": 40,
3843
+ "column": 9
3844
+ },
3845
+ "end": {
3846
+ "line": 41,
3847
+ "column": 6
3848
+ }
3849
+ },
3850
+ "range": [
3851
+ 746,
3852
+ 754
3853
+ ],
3854
+ "tail": false,
3855
+ "value": {
3856
+ "cooked": "\n ",
3857
+ "raw": "\n "
3858
+ }
3859
+ },
3860
+ {
3861
+ "type": "TemplateElement",
3862
+ "loc": {
3863
+ "source": null,
3864
+ "start": {
3865
+ "line": 41,
3866
+ "column": 7
3867
+ },
3868
+ "end": {
3869
+ "line": 42,
3870
+ "column": 3
3871
+ }
3872
+ },
3873
+ "range": [
3874
+ 755,
3875
+ 760
3876
+ ],
3877
+ "tail": true,
3878
+ "value": {
3879
+ "cooked": "\n ",
3880
+ "raw": "\n "
3881
+ }
3882
+ }
3883
+ ],
3884
+ "expressions": [
3885
+ {
3886
+ "type": "Identifier",
3887
+ "loc": {
3888
+ "source": null,
3889
+ "start": {
3890
+ "line": 41,
3891
+ "column": 6
3892
+ },
3893
+ "end": {
3894
+ "line": 41,
3895
+ "column": 7
3896
+ }
3897
+ },
3898
+ "name": "g",
3899
+ "typeAnnotation": null,
3900
+ "optional": false,
3901
+ "range": [
3902
+ 754,
3903
+ 755
3904
+ ]
3905
+ }
3906
+ ],
3907
+ "range": [
3908
+ 746,
3909
+ 760
3910
+ ]
3911
+ },
3912
+ "range": [
3913
+ 739,
3914
+ 760
3915
+ ]
3916
+ },
3917
+ "directive": null,
3918
+ "range": [
3919
+ 739,
3920
+ 761
3921
+ ]
3922
+ },
3923
+ {
3924
+ "type": "ExpressionStatement",
3925
+ "loc": {
3926
+ "source": null,
3927
+ "start": {
3928
+ "line": 44,
3929
+ "column": 2
3930
+ },
3931
+ "end": {
3932
+ "line": 44,
3933
+ "column": 17
3934
+ }
3935
+ },
3936
+ "expression": {
3937
+ "type": "TaggedTemplateExpression",
3938
+ "loc": {
3939
+ "source": null,
3940
+ "start": {
3941
+ "line": 44,
3942
+ "column": 2
3943
+ },
3944
+ "end": {
3945
+ "line": 44,
3946
+ "column": 16
3947
+ }
3948
+ },
3949
+ "tag": {
3950
+ "type": "Identifier",
3951
+ "loc": {
3952
+ "source": null,
3953
+ "start": {
3954
+ "line": 44,
3955
+ "column": 2
3956
+ },
3957
+ "end": {
3958
+ "line": 44,
3959
+ "column": 9
3960
+ }
3961
+ },
3962
+ "name": "graphql",
3963
+ "typeAnnotation": null,
3964
+ "optional": false,
3965
+ "range": [
3966
+ 765,
3967
+ 772
3968
+ ]
3969
+ },
3970
+ "quasi": {
3971
+ "type": "TemplateLiteral",
3972
+ "loc": {
3973
+ "source": null,
3974
+ "start": {
3975
+ "line": 44,
3976
+ "column": 9
3977
+ },
3978
+ "end": {
3979
+ "line": 44,
3980
+ "column": 16
3981
+ }
3982
+ },
3983
+ "quasis": [
3984
+ {
3985
+ "type": "TemplateElement",
3986
+ "loc": {
3987
+ "source": null,
3988
+ "start": {
3989
+ "line": 44,
3990
+ "column": 9
3991
+ },
3992
+ "end": {
3993
+ "line": 44,
3994
+ "column": 16
3995
+ }
3996
+ },
3997
+ "range": [
3998
+ 772,
3999
+ 779
4000
+ ],
4001
+ "tail": true,
4002
+ "value": {
4003
+ "cooked": "\\t\n",
4004
+ "raw": "\\\\t\\n"
4005
+ }
4006
+ }
4007
+ ],
4008
+ "expressions": [],
4009
+ "range": [
4010
+ 772,
4011
+ 779
4012
+ ]
4013
+ },
4014
+ "range": [
4015
+ 765,
4016
+ 779
4017
+ ]
4018
+ },
4019
+ "directive": null,
4020
+ "range": [
4021
+ 765,
4022
+ 780
4023
+ ]
4024
+ }
4025
+ ],
4026
+ "range": [
4027
+ 59,
4028
+ 782
4029
+ ]
4030
+ },
4031
+ "typeParameters": null,
4032
+ "returnType": null,
4033
+ "predicate": null,
4034
+ "generator": false,
4035
+ "async": false,
4036
+ "range": [
4037
+ 1,
4038
+ 782
4039
+ ]
4040
+ }
4041
+ ],
4042
+ "comments": [
4043
+ {
4044
+ "type": "Block",
4045
+ "loc": {
4046
+ "source": null,
4047
+ "start": {
4048
+ "line": 25,
4049
+ "column": 11
4050
+ },
4051
+ "end": {
4052
+ "line": 25,
4053
+ "column": 23
4054
+ }
4055
+ },
4056
+ "value": "* empty ",
4057
+ "range": [
4058
+ 525,
4059
+ 537
4060
+ ]
4061
+ }
4062
+ ],
4063
+ "interpreter": null,
4064
+ "range": [
4065
+ 1,
4066
+ 782
4067
+ ],
4068
+ "sourceType": "script"
4069
+ }
\ No newline at end of file
compiler/forget/crates/estree/src/lib.rs
new
+1266
@@ -0,0 +1,1266 @@
1
+use serde::{Deserialize, Serialize};
2
+use std::num::{NonZeroU32, NonZeroUsize};
3
+
4
+#[derive(Serialize, Deserialize, Debug)]
5
+pub struct SourceLocation {
6
+ pub source: Option<String>,
7
+
8
+ pub start: Position,
9
+
10
+ pub end: Position,
11
+}
12
+
13
+#[derive(Serialize, Deserialize, Debug)]
14
+pub struct Position {
15
+ /// >= 1
16
+ pub line: NonZeroUsize,
17
+ /// >= 0
18
+ pub column: u32,
19
+}
20
+
21
+#[derive(Serialize, Deserialize, Debug)]
22
+pub struct SourceRange {
23
+ pub start: u32,
24
+ pub end: NonZeroU32,
25
+}
26
+
27
+#[derive(Serialize, Deserialize, Debug)]
28
+pub struct Program {
29
+ /// sourceType
30
+ #[serde(default)]
31
+ pub source_type: SourceType,
32
+
33
+ pub body: Vec<ModuleItem>,
34
+
35
+ #[serde(default)]
36
+ pub comments: Option<Vec<Comment>>,
37
+
38
+ pub loc: Option<SourceLocation>,
39
+ #[serde(default)]
40
+ pub range: Option<SourceRange>,
41
+}
42
+
43
+#[derive(Serialize, Deserialize, Debug)]
44
+pub enum SourceType {
45
+ /// "module"
46
+ #[serde(rename = "module")]
47
+ Module,
48
+ /// "script"
49
+ #[serde(rename = "script")]
50
+ Script,
51
+}
52
+
53
+impl Default for SourceType {
54
+ fn default() -> Self {
55
+ Self::Module
56
+ }
57
+}
58
+
59
+#[derive(Serialize, Deserialize, Debug)]
60
+pub struct Comment {
61
+ pub type_: CommentType,
62
+ pub value: String,
63
+}
64
+
65
+#[derive(Serialize, Deserialize, Debug)]
66
+pub enum CommentType {
67
+ /// "Line"
68
+ Line,
69
+ /// "Block"
70
+ Block,
71
+}
72
+
73
+#[derive(Serialize, Deserialize, Debug)]
74
+#[serde(untagged)]
75
+pub enum ModuleItem {
76
+ Directive(Box<Directive>),
77
+ Statement(Box<Statement>),
78
+ ImportDeclaration(Box<ImportDeclaration>),
79
+ // TODO:
80
+ // ExportNamedDeclaration(Box<ExportNamedDeclaration>),
81
+ // ExportDefaultDeclaration(Box<ExportDefaultDeclaration>),
82
+ // ExportAllDeclaration(Box<ExportAllDeclaration>),
83
+}
84
+
85
+#[derive(Serialize, Deserialize, Debug)]
86
+pub struct Directive {
87
+ /// type = "ExpressionStatement"
88
+ pub type_: String,
89
+ pub expression: Literal,
90
+ pub directive: String,
91
+ pub loc: Option<SourceLocation>,
92
+ #[serde(default)]
93
+ pub range: Option<SourceRange>,
94
+}
95
+
96
+#[derive(Serialize, Deserialize, Debug)]
97
+pub struct ImportDeclaration {
98
+ pub specifiers: Vec<ImportSpecifiers>,
99
+ pub source: Literal,
100
+ pub loc: Option<SourceLocation>,
101
+ #[serde(default)]
102
+ pub range: Option<SourceRange>,
103
+}
104
+
105
+#[derive(Serialize, Deserialize, Debug)]
106
+#[serde(tag = "type")]
107
+pub enum ImportSpecifiers {
108
+ ImportSpecifier(Box<ImportSpecifier>),
109
+}
110
+
111
+#[derive(Serialize, Deserialize, Debug)]
112
+pub struct ImportSpecifier {
113
+ pub imported: Identifier,
114
+ pub loc: Option<SourceLocation>,
115
+ #[serde(default)]
116
+ pub range: Option<SourceRange>,
117
+}
118
+
119
+#[derive(Serialize, Deserialize, Debug)]
120
+#[serde(tag = "type")]
121
+pub enum Statement {
122
+ BlockStatement(Box<BlockStatement>),
123
+ BreakStatement(Box<BreakStatement>),
124
+ ClassDeclaration(Box<ClassDeclaration>),
125
+ ContinueStatement(Box<ContinueStatement>),
126
+ DebuggerStatement(Box<DebuggerStatement>),
127
+ DoWhileStatement(Box<DoWhileStatement>),
128
+ EmptyStatement(Box<EmptyStatement>),
129
+ ExpressionStatement(Box<ExpressionStatement>),
130
+ ForInStatement(Box<ForInStatement>),
131
+ ForOfStatement(Box<ForOfStatement>),
132
+ ForStatement(Box<ForStatement>),
133
+ FunctionDeclaration(Box<FunctionDeclaration>),
134
+ IfStatement(Box<IfStatement>),
135
+ LabeledStatement(Box<LabeledStatement>),
136
+ ReturnStatement(Box<ReturnStatement>),
137
+ StaticBlock(Box<StaticBlock>),
138
+ SwitchStatement(Box<SwitchStatement>),
139
+ ThrowStatement(Box<ThrowStatement>),
140
+ TryStatement(Box<TryStatement>),
141
+ VariableDeclaration(Box<VariableDeclaration>),
142
+ WhileStatement(Box<WhileStatement>),
143
+ WithStatement(Box<WithStatement>),
144
+}
145
+
146
+#[derive(Serialize, Deserialize, Debug)]
147
+pub struct BlockStatement {
148
+ pub body: Vec<Statement>,
149
+ pub loc: Option<SourceLocation>,
150
+ #[serde(default)]
151
+ pub range: Option<SourceRange>,
152
+}
153
+
154
+#[derive(Serialize, Deserialize, Debug)]
155
+pub struct BreakStatement {
156
+ #[serde(default)]
157
+ pub label: Option<Identifier>,
158
+ pub loc: Option<SourceLocation>,
159
+ #[serde(default)]
160
+ pub range: Option<SourceRange>,
161
+}
162
+
163
+#[derive(Serialize, Deserialize, Debug)]
164
+pub struct ClassDeclaration {
165
+ pub loc: Option<SourceLocation>,
166
+ #[serde(default)]
167
+ pub range: Option<SourceRange>,
168
+}
169
+
170
+#[derive(Serialize, Deserialize, Debug)]
171
+pub struct ContinueStatement {
172
+ #[serde(default)]
173
+ pub label: Option<Identifier>,
174
+ pub loc: Option<SourceLocation>,
175
+ #[serde(default)]
176
+ pub range: Option<SourceRange>,
177
+}
178
+
179
+#[derive(Serialize, Deserialize, Debug)]
180
+pub struct DebuggerStatement {
181
+ pub loc: Option<SourceLocation>,
182
+ #[serde(default)]
183
+ pub range: Option<SourceRange>,
184
+}
185
+
186
+#[derive(Serialize, Deserialize, Debug)]
187
+pub struct DoWhileStatement {
188
+ pub body: Statement,
189
+ pub test: ExpressionLike,
190
+ pub loc: Option<SourceLocation>,
191
+ #[serde(default)]
192
+ pub range: Option<SourceRange>,
193
+}
194
+
195
+#[derive(Serialize, Deserialize, Debug)]
196
+pub struct EmptyStatement {
197
+ pub loc: Option<SourceLocation>,
198
+ #[serde(default)]
199
+ pub range: Option<SourceRange>,
200
+}
201
+
202
+#[derive(Serialize, Deserialize, Debug)]
203
+pub struct FunctionDeclaration {
204
+ pub id: Option<Identifier>,
205
+
206
+ pub params: Vec<Pattern>,
207
+
208
+ #[serde(rename = "generator")]
209
+ #[serde(default)]
210
+ pub is_generator: bool,
211
+
212
+ #[serde(rename = "async")]
213
+ #[serde(default)]
214
+ pub is_async: bool,
215
+
216
+ // TODO: BlockStatement
217
+ pub body: Option<Statement>,
218
+
219
+ pub loc: Option<SourceLocation>,
220
+ #[serde(default)]
221
+ pub range: Option<SourceRange>,
222
+}
223
+
224
+#[derive(Serialize, Deserialize, Debug)]
225
+pub struct StaticBlock {
226
+ pub body: Vec<Statement>,
227
+ pub loc: Option<SourceLocation>,
228
+ #[serde(default)]
229
+ pub range: Option<SourceRange>,
230
+}
231
+
232
+#[derive(Serialize, Deserialize, Debug)]
233
+pub struct ExpressionStatement {
234
+ pub expression: ExpressionLike,
235
+
236
+ #[serde(default)]
237
+ pub directive: Option<String>,
238
+
239
+ pub loc: Option<SourceLocation>,
240
+
241
+ #[serde(default)]
242
+ pub range: Option<SourceRange>,
243
+}
244
+
245
+#[derive(Serialize, Deserialize, Debug)]
246
+pub struct ForInStatement {
247
+ pub left: ForPattern,
248
+ pub right: ExpressionLike,
249
+ pub body: Statement,
250
+ pub loc: Option<SourceLocation>,
251
+ #[serde(default)]
252
+ pub range: Option<SourceRange>,
253
+}
254
+
255
+#[derive(Serialize, Deserialize, Debug)]
256
+pub struct ForOfStatement {
257
+ #[serde(rename = "await")]
258
+ #[serde(default)]
259
+ pub is_await: bool,
260
+
261
+ pub left: ForPattern,
262
+
263
+ pub right: ExpressionLike,
264
+
265
+ pub body: Statement,
266
+
267
+ pub loc: Option<SourceLocation>,
268
+ #[serde(default)]
269
+ pub range: Option<SourceRange>,
270
+}
271
+
272
+#[derive(Serialize, Deserialize, Debug)]
273
+#[serde(tag = "type")]
274
+pub enum ForPattern {
275
+ VariableDeclaration(Box<VariableDeclaration>),
276
+ Expression(Box<ExpressionLike>),
277
+}
278
+
279
+#[derive(Serialize, Deserialize, Debug)]
280
+pub struct ForStatement {
281
+ pub init: Option<ForInit>,
282
+ pub test: Option<ExpressionLike>,
283
+ pub update: Option<ExpressionLike>,
284
+ pub body: Statement,
285
+ pub loc: Option<SourceLocation>,
286
+ #[serde(default)]
287
+ pub range: Option<SourceRange>,
288
+}
289
+
290
+#[derive(Serialize, Deserialize, Debug)]
291
+#[serde(tag = "type")]
292
+pub enum ForInit {
293
+ VariableDeclaration(Box<VariableDeclaration>),
294
+ Expression(Box<ExpressionLike>),
295
+}
296
+
297
+#[derive(Serialize, Deserialize, Debug)]
298
+pub struct IfStatement {
299
+ pub test: ExpressionLike,
300
+ pub consequent: Statement,
301
+ pub alternate: Option<Statement>,
302
+ pub loc: Option<SourceLocation>,
303
+ #[serde(default)]
304
+ pub range: Option<SourceRange>,
305
+}
306
+
307
+#[derive(Serialize, Deserialize, Debug)]
308
+pub struct LabeledStatement {
309
+ pub label: Identifier,
310
+ pub body: Statement,
311
+ pub loc: Option<SourceLocation>,
312
+ #[serde(default)]
313
+ pub range: Option<SourceRange>,
314
+}
315
+
316
+#[derive(Serialize, Deserialize, Debug)]
317
+pub struct ReturnStatement {
318
+ pub argument: Option<ExpressionLike>,
319
+ pub loc: Option<SourceLocation>,
320
+ #[serde(default)]
321
+ pub range: Option<SourceRange>,
322
+}
323
+
324
+#[derive(Serialize, Deserialize, Debug)]
325
+pub struct SwitchStatement {
326
+ pub discriminant: ExpressionLike,
327
+ pub cases: Vec<SwitchCase>,
328
+ pub loc: Option<SourceLocation>,
329
+ #[serde(default)]
330
+ pub range: Option<SourceRange>,
331
+}
332
+
333
+#[derive(Serialize, Deserialize, Debug)]
334
+pub struct SwitchCase {
335
+ pub test: Option<ExpressionLike>,
336
+ pub consequent: Vec<Statement>,
337
+ pub loc: Option<SourceLocation>,
338
+ #[serde(default)]
339
+ pub range: Option<SourceRange>,
340
+}
341
+
342
+#[derive(Serialize, Deserialize, Debug)]
343
+pub struct ThrowStatement {
344
+ pub argument: ExpressionLike,
345
+ pub loc: Option<SourceLocation>,
346
+ #[serde(default)]
347
+ pub range: Option<SourceRange>,
348
+}
349
+
350
+#[derive(Serialize, Deserialize, Debug)]
351
+pub struct TryStatement {
352
+ // TODO: block: BlockStatement
353
+ pub block: Statement,
354
+ pub handler: Option<CatchClause>,
355
+ // TODO: finalizer: BlockStatement
356
+ pub finalizer: Option<Statement>,
357
+ pub loc: Option<SourceLocation>,
358
+ #[serde(default)]
359
+ pub range: Option<SourceRange>,
360
+}
361
+
362
+#[derive(Serialize, Deserialize, Debug)]
363
+pub struct CatchClause {
364
+ pub param: Option<Pattern>,
365
+ pub body: Statement,
366
+ pub loc: Option<SourceLocation>,
367
+ #[serde(default)]
368
+ pub range: Option<SourceRange>,
369
+}
370
+
371
+#[derive(Serialize, Deserialize, Debug)]
372
+pub struct VariableDeclaration {
373
+ pub declarations: Vec<VariableDeclarator>,
374
+ pub kind: VariableDeclarationKind,
375
+ pub loc: Option<SourceLocation>,
376
+ #[serde(default)]
377
+ pub range: Option<SourceRange>,
378
+}
379
+
380
+#[derive(Serialize, Deserialize, Debug)]
381
+pub struct VariableDeclarator {
382
+ pub id: Pattern,
383
+ pub init: Option<ExpressionLike>,
384
+ pub loc: Option<SourceLocation>,
385
+ #[serde(default)]
386
+ pub range: Option<SourceRange>,
387
+}
388
+
389
+#[derive(Serialize, Deserialize, Debug)]
390
+pub enum VariableDeclarationKind {
391
+ #[serde(rename = "const")]
392
+ Const,
393
+ #[serde(rename = "let")]
394
+ Let,
395
+ #[serde(rename = "var")]
396
+ Var,
397
+}
398
+
399
+#[derive(Serialize, Deserialize, Debug)]
400
+pub struct WhileStatement {
401
+ pub test: ExpressionLike,
402
+ pub body: Statement,
403
+ pub loc: Option<SourceLocation>,
404
+ #[serde(default)]
405
+ pub range: Option<SourceRange>,
406
+}
407
+
408
+#[derive(Serialize, Deserialize, Debug)]
409
+pub struct WithStatement {
410
+ pub object: ExpressionLike,
411
+ pub body: Statement,
412
+ pub loc: Option<SourceLocation>,
413
+ #[serde(default)]
414
+ pub range: Option<SourceRange>,
415
+}
416
+
417
+/// Expressions and expression-like nodes
418
+/// we flatten these into a single enum to work around limits
419
+/// of serde enum format with handling arbitrary unions
420
+#[derive(Serialize, Deserialize, Debug)]
421
+#[serde(tag = "type")]
422
+pub enum ExpressionLike {
423
+ ArrayExpression(Box<ArrayExpression>),
424
+ ArrowFunctionExpression(Box<ArrowFunctionExpression>),
425
+ AssignmentExpression(Box<AssignmentExpression>),
426
+ AwaitExpression(Box<AwaitExpression>),
427
+ BinaryExpression(Box<BinaryExpression>),
428
+ CallExpression(Box<CallExpression>),
429
+ ChainExpression(Box<ChainExpression>),
430
+ ClassExpression(Box<ClassExpression>),
431
+ ConditionalExpression(Box<ConditionalExpression>),
432
+ FunctionExpression(Box<FunctionExpression>),
433
+ Identifier(Box<Identifier>),
434
+ ImportExpression(Box<ImportExpression>),
435
+ Literal(Box<Literal>),
436
+ LogicalExpression(Box<LogicalExpression>),
437
+ MemberExpression(Box<MemberExpression>),
438
+ MetaProperty(Box<MetaProperty>),
439
+ NewExpression(Box<NewExpression>),
440
+ ObjectExpression(Box<ObjectExpression>),
441
+ SequenceExpression(Box<SequenceExpression>),
442
+ TaggedTemplateExpression(Box<TaggedTemplateExpression>),
443
+ TemplateLiteral(Box<TemplateLiteral>),
444
+ ThisExpression(Box<ThisExpression>),
445
+ UnaryExpression(Box<UnaryExpression>),
446
+ UpdateExpression(Box<UpdateExpression>),
447
+ YieldExpression(Box<YieldExpression>),
448
+
449
+ // pseudo-expressions to work with serde
450
+ Super(Box<Super>),
451
+
452
+ // patterns to work with serde
453
+ ArrayPattern(Box<ArrayPattern>),
454
+ AssignmentPattern(Box<AssignmentPattern>),
455
+ ObjectPattern(Box<ObjectPattern>),
456
+ Property(Box<Property>),
457
+ RestElement(Box<RestElement>),
458
+ SpreadElement(Box<SpreadElement>),
459
+
460
+ // jsx expression-ish types to work with serde
461
+ JSXClosingElement(Box<JSXClosingElement>),
462
+ JSXElement(Box<JSXElement>),
463
+ JSXExpressionContainer(Box<JSXExpressionContainer>),
464
+ JSXIdentifier(Box<JSXIdentifier>),
465
+ JSXMemberExpression(Box<JSXMemberExpression>),
466
+ JSXNamedspacedName(Box<JSXNamedspacedName>),
467
+ JSXOpeningElement(Box<JSXOpeningElement>),
468
+ JSXText(Box<JSXText>),
469
+}
470
+
471
+#[derive(Serialize, Deserialize, Debug)]
472
+pub struct ArrayExpression {
473
+ pub elements: Vec<ExpressionLike>,
474
+ pub loc: Option<SourceLocation>,
475
+ #[serde(default)]
476
+ pub range: Option<SourceRange>,
477
+}
478
+
479
+#[derive(Serialize, Deserialize, Debug)]
480
+pub struct ArrowFunctionExpression {
481
+ pub params: Vec<Pattern>,
482
+
483
+ #[serde(rename = "generator")]
484
+ #[serde(default)]
485
+ pub is_generator: bool,
486
+
487
+ #[serde(rename = "async")]
488
+ #[serde(default)]
489
+ pub is_async: bool,
490
+
491
+ #[serde(rename = "expression")]
492
+ #[serde(default)]
493
+ pub is_expression: bool,
494
+
495
+ pub body: BlockOrExpression,
496
+
497
+ pub loc: Option<SourceLocation>,
498
+ #[serde(default)]
499
+ pub range: Option<SourceRange>,
500
+}
501
+
502
+#[derive(Serialize, Deserialize, Debug)]
503
+#[serde(tag = "type")]
504
+pub enum BlockOrExpression {
505
+ BlockStatement(Box<BlockStatement>),
506
+ Expression(Box<ExpressionLike>),
507
+}
508
+
509
+#[derive(Serialize, Deserialize, Debug)]
510
+pub struct AssignmentExpression {
511
+ pub operator: AssignmentOperator,
512
+ pub left: AssignmentTarget,
513
+ pub right: ExpressionLike,
514
+ pub loc: Option<SourceLocation>,
515
+ #[serde(default)]
516
+ pub range: Option<SourceRange>,
517
+}
518
+
519
+#[derive(Serialize, Deserialize, Debug)]
520
+pub enum AssignmentOperator {
521
+ /// =
522
+ #[serde(rename = "=")]
523
+ Equals,
524
+ /// +=
525
+ #[serde(rename = "+=")]
526
+ PlusEquals,
527
+ // -=
528
+ #[serde(rename = "-=")]
529
+ MinusEquals,
530
+ /// *=
531
+ #[serde(rename = "*=")]
532
+ AsteriskEquals,
533
+ /// /=
534
+ #[serde(rename = "/=")]
535
+ SlashEquals,
536
+ /// %=
537
+ #[serde(rename = "%=")]
538
+ PercentEquals,
539
+ /// **=
540
+ #[serde(rename = "**=")]
541
+ AsteriskAsteriskEquals,
542
+ /// <<=
543
+ #[serde(rename = "<<=")]
544
+ LtLtEquals,
545
+ /// >>=
546
+ #[serde(rename = ">>=")]
547
+ GtGtEquals,
548
+ /// >>>=
549
+ #[serde(rename = ">>>=")]
550
+ GtGtGtEquals,
551
+ /// |=
552
+ #[serde(rename = "|=")]
553
+ PipeEquals,
554
+ /// ^=
555
+ #[serde(rename = "^=")]
556
+ CaretEquals,
557
+ /// &=
558
+ #[serde(rename = "&&=")]
559
+ AmpersandEquals,
560
+ /// ||=
561
+ #[serde(rename = "||=")]
562
+ PipePipeEquals,
563
+ /// &&=
564
+ #[serde(rename = "&&=")]
565
+ AmpersandAmpersandEquals,
566
+ // ??=
567
+ #[serde(rename = "??=")]
568
+ QuestionQuestionEquals,
569
+}
570
+
571
+impl AssignmentOperator {
572
+ pub fn is_simple_equals(&self) -> bool {
573
+ matches!(self, AssignmentOperator::Equals)
574
+ }
575
+}
576
+
577
+#[derive(Serialize, Deserialize, Debug)]
578
+#[serde(untagged)]
579
+pub enum AssignmentTarget {
580
+ Pattern(Box<Pattern>),
581
+ MemberExpression(Box<MemberExpression>),
582
+}
583
+
584
+#[derive(Serialize, Deserialize, Debug)]
585
+pub struct AwaitExpression {
586
+ pub argument: ExpressionLike,
587
+ pub loc: Option<SourceLocation>,
588
+ #[serde(default)]
589
+ pub range: Option<SourceRange>,
590
+}
591
+
592
+#[derive(Serialize, Deserialize, Debug)]
593
+pub struct BinaryExpression {
594
+ pub operator: BinaryOperator,
595
+ pub left: ExpressionLike,
596
+ pub right: ExpressionLike,
597
+ pub loc: Option<SourceLocation>,
598
+ #[serde(default)]
599
+ pub range: Option<SourceRange>,
600
+}
601
+
602
+#[derive(Serialize, Deserialize, Debug)]
603
+pub enum BinaryOperator {
604
+ /// ==
605
+ #[serde(rename = "==")]
606
+ EqualsEquals,
607
+ /// !=
608
+ #[serde(rename = "!=")]
609
+ NotEquals,
610
+ /// ===
611
+ #[serde(rename = "===")]
612
+ TripleEquals,
613
+ /// !==
614
+ #[serde(rename = "!==")]
615
+ NotTripleEquals,
616
+ /// <
617
+ #[serde(rename = "<")]
618
+ LessThan,
619
+ /// <=
620
+ #[serde(rename = "<=")]
621
+ LessThanEquals,
622
+ /// >
623
+ #[serde(rename = ">")]
624
+ GreaterThan,
625
+ /// >=
626
+ #[serde(rename = ">=")]
627
+ GreaterThanEquals,
628
+ /// <<
629
+ #[serde(rename = "<<")]
630
+ LtLt,
631
+ /// >>
632
+ #[serde(rename = ">>")]
633
+ GtGt,
634
+ /// >>>
635
+ #[serde(rename = ">>>")]
636
+ GtGtGt,
637
+ /// +
638
+ #[serde(rename = "+")]
639
+ Plus,
640
+ /// -
641
+ #[serde(rename = "-")]
642
+ Minus,
643
+ /// *
644
+ #[serde(rename = "*")]
645
+ Asterisk,
646
+ /// /
647
+ #[serde(rename = "/")]
648
+ Slash,
649
+ /// %
650
+ #[serde(rename = "%")]
651
+ Percent,
652
+ /// **
653
+ #[serde(rename = "**")]
654
+ AsteriskAsterisk,
655
+ /// |
656
+ #[serde(rename = "|")]
657
+ Pipe,
658
+ /// ^
659
+ #[serde(rename = "^")]
660
+ Caret,
661
+ /// &
662
+ #[serde(rename = "&")]
663
+ Ampersand,
664
+ /// in
665
+ #[serde(rename = "in")]
666
+ In,
667
+ /// instanceof
668
+ #[serde(rename = "instanceof")]
669
+ Instanceof,
670
+}
671
+
672
+#[derive(Serialize, Deserialize, Debug)]
673
+pub struct CallExpression {
674
+ #[serde(rename = "optional")]
675
+ #[serde(default)]
676
+ pub is_optional: bool,
677
+
678
+ pub callee: ExpressionLike,
679
+
680
+ pub arguments: Vec<ExpressionLike>,
681
+
682
+ pub loc: Option<SourceLocation>,
683
+ #[serde(default)]
684
+ pub range: Option<SourceRange>,
685
+}
686
+
687
+#[derive(Serialize, Deserialize, Debug)]
688
+pub struct ChainExpression {
689
+ pub expression: ChainElement,
690
+ pub loc: Option<SourceLocation>,
691
+ #[serde(default)]
692
+ pub range: Option<SourceRange>,
693
+}
694
+
695
+#[derive(Serialize, Deserialize, Debug)]
696
+#[serde(tag = "type")]
697
+pub enum ChainElement {
698
+ CallExpression(Box<CallExpression>),
699
+ MemberExpression(Box<MemberExpression>),
700
+}
701
+
702
+#[derive(Serialize, Deserialize, Debug)]
703
+pub struct ClassExpression {
704
+ // TODO
705
+ pub loc: Option<SourceLocation>,
706
+ #[serde(default)]
707
+ pub range: Option<SourceRange>,
708
+}
709
+
710
+#[derive(Serialize, Deserialize, Debug)]
711
+pub struct ConditionalExpression {
712
+ pub test: ExpressionLike,
713
+ pub alternate: ExpressionLike,
714
+ pub consequent: ExpressionLike,
715
+ pub loc: Option<SourceLocation>,
716
+ #[serde(default)]
717
+ pub range: Option<SourceRange>,
718
+}
719
+
720
+#[derive(Serialize, Deserialize, Debug)]
721
+pub struct FunctionExpression {
722
+ // TODO
723
+ pub loc: Option<SourceLocation>,
724
+ #[serde(default)]
725
+ pub range: Option<SourceRange>,
726
+}
727
+
728
+#[derive(Serialize, Deserialize, Debug)]
729
+pub struct ImportExpression {
730
+ // TODO
731
+ pub loc: Option<SourceLocation>,
732
+ #[serde(default)]
733
+ pub range: Option<SourceRange>,
734
+}
735
+
736
+#[derive(Serialize, Deserialize, Debug)]
737
+pub struct Literal {
738
+ pub value: LiteralValue,
739
+
740
+ #[serde(default)]
741
+ pub raw: Option<String>,
742
+
743
+ pub loc: Option<SourceLocation>,
744
+
745
+ #[serde(default)]
746
+ pub range: Option<SourceRange>,
747
+}
748
+
749
+#[derive(Serialize, Deserialize, Debug)]
750
+#[serde(untagged)]
751
+pub enum LiteralValue {
752
+ BigInt(String),
753
+ Boolean(bool),
754
+ Null,
755
+ Number(Number),
756
+ RegExp(RegExp),
757
+ String(String),
758
+}
759
+
760
+#[derive(Serialize, Deserialize, Debug)]
761
+pub struct Number(u64);
762
+
763
+impl From<u64> for Number {
764
+ fn from(value: u64) -> Self {
765
+ Number(value)
766
+ }
767
+}
768
+
769
+impl From<f64> for Number {
770
+ fn from(value: f64) -> Self {
771
+ Number(value.to_bits())
772
+ }
773
+}
774
+
775
+impl From<Number> for f64 {
776
+ fn from(value: Number) -> Self {
777
+ f64::from_bits(value.0)
778
+ }
779
+}
780
+
781
+#[derive(Serialize, Deserialize, Debug)]
782
+pub struct RegExp {
783
+ pub raw: Option<String>,
784
+ pub regex: Option<RegExpValue>,
785
+}
786
+
787
+#[derive(Serialize, Deserialize, Debug)]
788
+pub struct RegExpValue {
789
+ pub pattern: String,
790
+ pub flags: String,
791
+}
792
+
793
+#[derive(Serialize, Deserialize, Debug)]
794
+pub struct LogicalExpression {
795
+ pub operator: LogicalOperator,
796
+ pub left: ExpressionLike,
797
+ pub right: ExpressionLike,
798
+ pub loc: Option<SourceLocation>,
799
+ #[serde(default)]
800
+ pub range: Option<SourceRange>,
801
+}
802
+
803
+#[derive(Serialize, Deserialize, Debug)]
804
+pub enum LogicalOperator {
805
+ /// ||
806
+ #[serde(rename = "||")]
807
+ PipePipe,
808
+ /// &&
809
+ #[serde(rename = "&&")]
810
+ AmpersandAmpersand,
811
+ /// ??
812
+ #[serde(rename = "??")]
813
+ QuestionQuestion,
814
+}
815
+
816
+#[derive(Serialize, Deserialize, Debug)]
817
+pub struct MetaProperty {
818
+ // TODO
819
+ pub loc: Option<SourceLocation>,
820
+ #[serde(default)]
821
+ pub range: Option<SourceRange>,
822
+}
823
+
824
+#[derive(Serialize, Deserialize, Debug)]
825
+pub struct NewExpression {
826
+ pub callee: ExpressionLike,
827
+ pub arguments: Vec<ExpressionLike>,
828
+ pub loc: Option<SourceLocation>,
829
+ #[serde(default)]
830
+ pub range: Option<SourceRange>,
831
+}
832
+
833
+#[derive(Serialize, Deserialize, Debug)]
834
+pub struct ObjectExpression {
835
+ pub properties: Vec<ExpressionLike>,
836
+ pub loc: Option<SourceLocation>,
837
+ #[serde(default)]
838
+ pub range: Option<SourceRange>,
839
+}
840
+
841
+#[derive(Serialize, Deserialize, Debug)]
842
+pub struct SequenceExpression {
843
+ pub expressions: Vec<ExpressionLike>,
844
+ pub loc: Option<SourceLocation>,
845
+ #[serde(default)]
846
+ pub range: Option<SourceRange>,
847
+}
848
+
849
+#[derive(Serialize, Deserialize, Debug)]
850
+pub struct TaggedTemplateExpression {
851
+ pub tag: ExpressionLike,
852
+ pub quasi: TemplateLiteral,
853
+ pub loc: Option<SourceLocation>,
854
+ #[serde(default)]
855
+ pub range: Option<SourceRange>,
856
+}
857
+
858
+#[derive(Serialize, Deserialize, Debug)]
859
+pub struct TemplateLiteral {
860
+ pub quasis: Vec<TemplateElement>,
861
+ pub expressions: Vec<ExpressionLike>,
862
+ pub loc: Option<SourceLocation>,
863
+ #[serde(default)]
864
+ pub range: Option<SourceRange>,
865
+}
866
+
867
+#[derive(Serialize, Deserialize, Debug)]
868
+pub struct TemplateElement {
869
+ #[serde(rename = "tail")]
870
+ #[serde(default)]
871
+ pub is_tail: bool,
872
+
873
+ // TODO: add value: {cooked, raw} wrapper object
874
+ pub cooked: Option<String>,
875
+
876
+ pub raw: String,
877
+
878
+ pub loc: Option<SourceLocation>,
879
+ #[serde(default)]
880
+ pub range: Option<SourceRange>,
881
+}
882
+
883
+#[derive(Serialize, Deserialize, Debug)]
884
+pub struct ThisExpression {
885
+ // TODO
886
+ pub loc: Option<SourceLocation>,
887
+ #[serde(default)]
888
+ pub range: Option<SourceRange>,
889
+}
890
+
891
+#[derive(Serialize, Deserialize, Debug)]
892
+pub struct UnaryExpression {
893
+ pub operator: UnaryOperator,
894
+
895
+ #[serde(rename = "prefix")]
896
+ #[serde(default)]
897
+ pub is_prefix: bool,
898
+
899
+ pub argument: ExpressionLike,
900
+
901
+ pub loc: Option<SourceLocation>,
902
+ #[serde(default)]
903
+ pub range: Option<SourceRange>,
904
+}
905
+
906
+#[derive(Serialize, Deserialize, Debug)]
907
+pub enum UnaryOperator {
908
+ /// -
909
+ #[serde(rename = "+")]
910
+ Minus,
911
+ /// +
912
+ #[serde(rename = "+")]
913
+ Plus,
914
+ /// !
915
+ #[serde(rename = "!")]
916
+ Exclamation,
917
+ /// ~
918
+ #[serde(rename = "~")]
919
+ Tilde,
920
+ /// typeof
921
+ #[serde(rename = "typeof")]
922
+ Typeof,
923
+ /// void
924
+ #[serde(rename = "void")]
925
+ Void,
926
+ /// delete
927
+ #[serde(rename = "delete")]
928
+ Delete,
929
+}
930
+
931
+#[derive(Serialize, Deserialize, Debug)]
932
+pub struct UpdateExpression {
933
+ pub operator: UpdateOperator,
934
+
935
+ pub argument: ExpressionLike,
936
+
937
+ #[serde(rename = "prefix")]
938
+ #[serde(default)]
939
+ pub is_prefix: bool,
940
+
941
+ pub loc: Option<SourceLocation>,
942
+ #[serde(default)]
943
+ pub range: Option<SourceRange>,
944
+}
945
+
946
+#[derive(Serialize, Deserialize, Debug)]
947
+pub enum UpdateOperator {
948
+ /// ++
949
+ #[serde(rename = "++")]
950
+ PlusPlus,
951
+ /// --
952
+ #[serde(rename = "--")]
953
+ MinusMinus,
954
+}
955
+
956
+#[derive(Serialize, Deserialize, Debug)]
957
+pub struct YieldExpression {
958
+ pub argument: Option<ExpressionLike>,
959
+
960
+ #[serde(rename = "delegate")]
961
+ #[serde(default)]
962
+ pub is_delegate: bool,
963
+
964
+ pub loc: Option<SourceLocation>,
965
+ #[serde(default)]
966
+ pub range: Option<SourceRange>,
967
+}
968
+
969
+// Pattern etc
970
+
971
+#[derive(Serialize, Deserialize, Debug)]
972
+#[serde(tag = "type")]
973
+pub enum Pattern {
974
+ ArrayPattern(Box<ArrayPattern>),
975
+ AssignmentPattern(Box<AssignmentPattern>),
976
+ Identifier(Box<Identifier>),
977
+ MemberExpression(Box<MemberExpression>),
978
+ ObjectPattern(Box<ObjectPattern>),
979
+ RestElement(Box<RestElement>),
980
+}
981
+
982
+#[derive(Serialize, Deserialize, Debug)]
983
+pub struct ArrayPattern {
984
+ pub elements: Vec<Pattern>,
985
+
986
+ pub loc: Option<SourceLocation>,
987
+ #[serde(default)]
988
+ pub range: Option<SourceRange>,
989
+}
990
+
991
+#[derive(Serialize, Deserialize, Debug)]
992
+pub struct AssignmentPattern {
993
+ pub left: Pattern,
994
+ pub right: ExpressionLike,
995
+ pub loc: Option<SourceLocation>,
996
+ #[serde(default)]
997
+ pub range: Option<SourceRange>,
998
+}
999
+
1000
+#[derive(Serialize, Deserialize, Debug)]
1001
+pub struct Identifier {
1002
+ pub name: String,
1003
+ pub loc: Option<SourceLocation>,
1004
+ #[serde(default)]
1005
+ pub range: Option<SourceRange>,
1006
+}
1007
+
1008
+#[derive(Serialize, Deserialize, Debug)]
1009
+pub struct MemberExpression {
1010
+ pub object: ExpressionLike,
1011
+
1012
+ pub property: ExpressionLike, // ExpressionOrPrivateIdentifier
1013
+
1014
+ #[serde(rename = "computed")]
1015
+ #[serde(default)]
1016
+ pub is_computed: bool,
1017
+
1018
+ #[serde(rename = "optional")]
1019
+ #[serde(default)]
1020
+ pub is_optional: bool,
1021
+
1022
+ pub loc: Option<SourceLocation>,
1023
+ #[serde(default)]
1024
+ pub range: Option<SourceRange>,
1025
+}
1026
+
1027
+#[derive(Serialize, Deserialize, Debug)]
1028
+pub struct Super {
1029
+ pub loc: Option<SourceLocation>,
1030
+ #[serde(default)]
1031
+ pub range: Option<SourceRange>,
1032
+}
1033
+
1034
+#[derive(Serialize, Deserialize, Debug)]
1035
+pub struct PrivateIdentifier {
1036
+ pub name: String,
1037
+ pub loc: Option<SourceLocation>,
1038
+ #[serde(default)]
1039
+ pub range: Option<SourceRange>,
1040
+}
1041
+
1042
+#[derive(Serialize, Deserialize, Debug)]
1043
+pub struct ObjectPattern {
1044
+ pub properties: Vec<ExpressionLike>,
1045
+ pub loc: Option<SourceLocation>,
1046
+ #[serde(default)]
1047
+ pub range: Option<SourceRange>,
1048
+}
1049
+
1050
+#[derive(Serialize, Deserialize, Debug)]
1051
+pub struct Property {
1052
+ pub key: ExpressionLike,
1053
+
1054
+ pub value: PropertyValue,
1055
+
1056
+ pub kind: PropertyKind,
1057
+
1058
+ #[serde(rename = "method")]
1059
+ #[serde(default)]
1060
+ pub is_method: bool,
1061
+
1062
+ #[serde(rename = "shorthand")]
1063
+ #[serde(default)]
1064
+ pub is_shorthand: bool,
1065
+
1066
+ #[serde(rename = "computed")]
1067
+ #[serde(default)]
1068
+ pub is_computed: bool,
1069
+
1070
+ pub loc: Option<SourceLocation>,
1071
+ #[serde(default)]
1072
+ pub range: Option<SourceRange>,
1073
+}
1074
+
1075
+#[derive(Serialize, Deserialize, Debug)]
1076
+#[serde(untagged)]
1077
+pub enum PropertyValue {
1078
+ Expression(Box<ExpressionLike>),
1079
+ Pattern(Box<Pattern>),
1080
+}
1081
+
1082
+#[derive(Serialize, Deserialize, Debug)]
1083
+pub enum PropertyKind {
1084
+ #[serde(rename = "init")]
1085
+ Init,
1086
+ #[serde(rename = "get")]
1087
+ Get,
1088
+ #[serde(rename = "set")]
1089
+ Set,
1090
+}
1091
+
1092
+impl Default for PropertyKind {
1093
+ fn default() -> Self {
1094
+ Self::Init
1095
+ }
1096
+}
1097
+
1098
+#[derive(Serialize, Deserialize, Debug)]
1099
+pub struct RestElement {
1100
+ pub argument: Pattern,
1101
+ pub loc: Option<SourceLocation>,
1102
+ #[serde(default)]
1103
+ pub range: Option<SourceRange>,
1104
+}
1105
+
1106
+#[derive(Serialize, Deserialize, Debug)]
1107
+pub struct SpreadElement {
1108
+ pub argument: ExpressionLike,
1109
+ pub loc: Option<SourceLocation>,
1110
+ #[serde(default)]
1111
+ pub range: Option<SourceRange>,
1112
+}
1113
+
1114
+#[derive(Serialize, Deserialize, Debug)]
1115
+pub struct JSXElement {
1116
+ #[serde(rename = "openingElement")]
1117
+ pub opening_element: ExpressionLike,
1118
+
1119
+ pub children: Vec<ExpressionLike>,
1120
+
1121
+ #[serde(rename = "closingElement")]
1122
+ pub closing_element: Option<ExpressionLike>,
1123
+
1124
+ pub loc: Option<SourceLocation>,
1125
+
1126
+ #[serde(default)]
1127
+ pub range: Option<SourceRange>,
1128
+}
1129
+
1130
+#[derive(Serialize, Deserialize, Debug)]
1131
+pub struct JSXOpeningElement {
1132
+ pub name: ExpressionLike,
1133
+
1134
+ pub attributes: Vec<JSXAttribute>,
1135
+
1136
+ #[serde(rename = "selfClosing")]
1137
+ #[serde(default)]
1138
+ pub self_closing: bool,
1139
+
1140
+ pub loc: Option<SourceLocation>,
1141
+
1142
+ #[serde(default)]
1143
+ pub range: Option<SourceRange>,
1144
+}
1145
+
1146
+#[derive(Serialize, Deserialize, Debug)]
1147
+pub struct JSXClosingElement {
1148
+ pub name: ExpressionLike,
1149
+
1150
+ pub loc: Option<SourceLocation>,
1151
+
1152
+ #[serde(default)]
1153
+ pub range: Option<SourceRange>,
1154
+}
1155
+
1156
+#[derive(Serialize, Deserialize, Debug)]
1157
+pub struct JSXMemberExpression {
1158
+ pub object: ExpressionLike,
1159
+
1160
+ pub property: ExpressionLike,
1161
+
1162
+ pub loc: Option<SourceLocation>,
1163
+
1164
+ #[serde(default)]
1165
+ pub range: Option<SourceRange>,
1166
+}
1167
+
1168
+#[derive(Serialize, Deserialize, Debug)]
1169
+pub struct JSXIdentifier {
1170
+ pub name: String,
1171
+
1172
+ pub loc: Option<SourceLocation>,
1173
+
1174
+ #[serde(default)]
1175
+ pub range: Option<SourceRange>,
1176
+}
1177
+
1178
+#[derive(Serialize, Deserialize, Debug)]
1179
+pub struct JSXNamedspacedName {
1180
+ pub namespace: ExpressionLike,
1181
+
1182
+ pub name: ExpressionLike,
1183
+
1184
+ pub loc: Option<SourceLocation>,
1185
+
1186
+ #[serde(default)]
1187
+ pub range: Option<SourceRange>,
1188
+}
1189
+
1190
+#[derive(Serialize, Deserialize, Debug)]
1191
+pub struct JSXAttribute {
1192
+ pub name: ExpressionLike,
1193
+
1194
+ pub value: ExpressionLike,
1195
+
1196
+ pub loc: Option<SourceLocation>,
1197
+
1198
+ #[serde(default)]
1199
+ pub range: Option<SourceRange>,
1200
+}
1201
+
1202
+#[derive(Serialize, Deserialize, Debug)]
1203
+pub struct JSXExpressionContainer {
1204
+ expression: ExpressionLike,
1205
+
1206
+ pub loc: Option<SourceLocation>,
1207
+
1208
+ #[serde(default)]
1209
+ pub range: Option<SourceRange>,
1210
+}
1211
+
1212
+#[derive(Serialize, Deserialize, Debug)]
1213
+pub struct JSXText {
1214
+ value: String,
1215
+ raw: String,
1216
+
1217
+ pub loc: Option<SourceLocation>,
1218
+
1219
+ #[serde(default)]
1220
+ pub range: Option<SourceRange>,
1221
+}
1222
+
1223
+#[cfg(test)]
1224
+mod tests {
1225
+ use super::*;
1226
+ use serde_json;
1227
+
1228
+ #[test]
1229
+ fn for_statement() {
1230
+ let source = include_str!("for-statement.json");
1231
+ let ast: Program = serde_json::from_str(&source).unwrap();
1232
+ println!("deserialized:\n{:#?}", ast);
1233
+ let serialized = serde_json::to_string_pretty(&ast).unwrap();
1234
+ println!("serialized:\n{}", serialized);
1235
+ }
1236
+
1237
+ #[test]
1238
+ fn simple() {
1239
+ let source = include_str!("simple.json");
1240
+ let ast: Program = serde_json::from_str(&source).unwrap();
1241
+ println!("deserialized:\n{:#?}", ast);
1242
+ let serialized = serde_json::to_string_pretty(&ast).unwrap();
1243
+ println!("serialized:\n{}", serialized);
1244
+ }
1245
+
1246
+ /// TODO: enable once this deserializes
1247
+ fn _kitchen_sink() {
1248
+ let source = include_str!("kitchen-sink.json");
1249
+ let ast: Program = match serde_json::from_str(&source) {
1250
+ Ok(ast) => ast,
1251
+ Err(err) => panic!("{:#?}", err),
1252
+ };
1253
+ println!("deserialized:\n{:#?}", ast);
1254
+ let serialized = serde_json::to_string_pretty(&ast).unwrap();
1255
+ println!("serialized:\n{}", serialized);
1256
+ }
1257
+
1258
+ #[test]
1259
+ fn test() {
1260
+ let source = include_str!("test.json");
1261
+ let ast: Program = serde_json::from_str(&source).unwrap();
1262
+ println!("deserialized:\n{:#?}", ast);
1263
+ let serialized = serde_json::to_string_pretty(&ast).unwrap();
1264
+ println!("serialized:\n{}", serialized);
1265
+ }
1266
+}
compiler/forget/crates/estree/src/simple.json
new
+189
@@ -0,0 +1,189 @@
1
+{
2
+ "type": "Program",
3
+ "loc": {
4
+ "source": null,
5
+ "start": {
6
+ "line": 1,
7
+ "column": 0
8
+ },
9
+ "end": {
10
+ "line": 3,
11
+ "column": 1
12
+ }
13
+ },
14
+ "range": [
15
+ 0,
16
+ 51
17
+ ],
18
+ "body": [
19
+ {
20
+ "type": "FunctionDeclaration",
21
+ "loc": {
22
+ "source": null,
23
+ "start": {
24
+ "line": 1,
25
+ "column": 0
26
+ },
27
+ "end": {
28
+ "line": 3,
29
+ "column": 1
30
+ }
31
+ },
32
+ "range": [
33
+ 0,
34
+ 51
35
+ ],
36
+ "id": {
37
+ "type": "Identifier",
38
+ "loc": {
39
+ "source": null,
40
+ "start": {
41
+ "line": 1,
42
+ "column": 9
43
+ },
44
+ "end": {
45
+ "line": 1,
46
+ "column": 18
47
+ }
48
+ },
49
+ "range": [
50
+ 9,
51
+ 18
52
+ ],
53
+ "name": "Component",
54
+ "typeAnnotation": null,
55
+ "optional": false
56
+ },
57
+ "params": [
58
+ {
59
+ "type": "Identifier",
60
+ "loc": {
61
+ "source": null,
62
+ "start": {
63
+ "line": 1,
64
+ "column": 19
65
+ },
66
+ "end": {
67
+ "line": 1,
68
+ "column": 24
69
+ }
70
+ },
71
+ "range": [
72
+ 19,
73
+ 24
74
+ ],
75
+ "name": "props",
76
+ "typeAnnotation": null,
77
+ "optional": false
78
+ }
79
+ ],
80
+ "body": {
81
+ "type": "BlockStatement",
82
+ "loc": {
83
+ "source": null,
84
+ "start": {
85
+ "line": 1,
86
+ "column": 26
87
+ },
88
+ "end": {
89
+ "line": 3,
90
+ "column": 1
91
+ }
92
+ },
93
+ "range": [
94
+ 26,
95
+ 51
96
+ ],
97
+ "body": [
98
+ {
99
+ "type": "ReturnStatement",
100
+ "loc": {
101
+ "source": null,
102
+ "start": {
103
+ "line": 2,
104
+ "column": 2
105
+ },
106
+ "end": {
107
+ "line": 2,
108
+ "column": 21
109
+ }
110
+ },
111
+ "range": [
112
+ 30,
113
+ 49
114
+ ],
115
+ "argument": {
116
+ "type": "MemberExpression",
117
+ "loc": {
118
+ "source": null,
119
+ "start": {
120
+ "line": 2,
121
+ "column": 9
122
+ },
123
+ "end": {
124
+ "line": 2,
125
+ "column": 20
126
+ }
127
+ },
128
+ "range": [
129
+ 37,
130
+ 48
131
+ ],
132
+ "object": {
133
+ "type": "Identifier",
134
+ "loc": {
135
+ "source": null,
136
+ "start": {
137
+ "line": 2,
138
+ "column": 9
139
+ },
140
+ "end": {
141
+ "line": 2,
142
+ "column": 14
143
+ }
144
+ },
145
+ "range": [
146
+ 37,
147
+ 42
148
+ ],
149
+ "name": "props",
150
+ "typeAnnotation": null,
151
+ "optional": false
152
+ },
153
+ "property": {
154
+ "type": "Identifier",
155
+ "loc": {
156
+ "source": null,
157
+ "start": {
158
+ "line": 2,
159
+ "column": 15
160
+ },
161
+ "end": {
162
+ "line": 2,
163
+ "column": 20
164
+ }
165
+ },
166
+ "range": [
167
+ 43,
168
+ 48
169
+ ],
170
+ "name": "value",
171
+ "typeAnnotation": null,
172
+ "optional": false
173
+ },
174
+ "computed": false
175
+ }
176
+ }
177
+ ]
178
+ },
179
+ "async": false,
180
+ "generator": false,
181
+ "predicate": null,
182
+ "expression": false,
183
+ "returnType": null,
184
+ "typeParameters": null
185
+ }
186
+ ],
187
+ "comments": [],
188
+ "errors": []
189
+ }
\ No newline at end of file
compiler/forget/crates/estree/src/test.json
new
+351
@@ -0,0 +1,351 @@
1
+{
2
+ "type": "Program",
3
+ "loc": {
4
+ "source": null,
5
+ "start": {
6
+ "line": 2,
7
+ "column": 0
8
+ },
9
+ "end": {
10
+ "line": 4,
11
+ "column": 1
12
+ }
13
+ },
14
+ "body": [
15
+ {
16
+ "type": "FunctionDeclaration",
17
+ "loc": {
18
+ "source": null,
19
+ "start": {
20
+ "line": 2,
21
+ "column": 0
22
+ },
23
+ "end": {
24
+ "line": 4,
25
+ "column": 1
26
+ }
27
+ },
28
+ "id": {
29
+ "type": "Identifier",
30
+ "loc": {
31
+ "source": null,
32
+ "start": {
33
+ "line": 2,
34
+ "column": 9
35
+ },
36
+ "end": {
37
+ "line": 2,
38
+ "column": 12
39
+ }
40
+ },
41
+ "name": "foo",
42
+ "typeAnnotation": null,
43
+ "optional": false,
44
+ "range": [
45
+ 10,
46
+ 13
47
+ ]
48
+ },
49
+ "params": [],
50
+ "body": {
51
+ "type": "BlockStatement",
52
+ "loc": {
53
+ "source": null,
54
+ "start": {
55
+ "line": 2,
56
+ "column": 15
57
+ },
58
+ "end": {
59
+ "line": 4,
60
+ "column": 1
61
+ }
62
+ },
63
+ "body": [
64
+ {
65
+ "type": "ReturnStatement",
66
+ "loc": {
67
+ "source": null,
68
+ "start": {
69
+ "line": 3,
70
+ "column": 2
71
+ },
72
+ "end": {
73
+ "line": 3,
74
+ "column": 36
75
+ }
76
+ },
77
+ "argument": {
78
+ "type": "JSXElement",
79
+ "loc": {
80
+ "source": null,
81
+ "start": {
82
+ "line": 3,
83
+ "column": 9
84
+ },
85
+ "end": {
86
+ "line": 3,
87
+ "column": 36
88
+ }
89
+ },
90
+ "openingElement": {
91
+ "type": "JSXOpeningElement",
92
+ "loc": {
93
+ "source": null,
94
+ "start": {
95
+ "line": 3,
96
+ "column": 9
97
+ },
98
+ "end": {
99
+ "line": 3,
100
+ "column": 26
101
+ }
102
+ },
103
+ "name": {
104
+ "type": "JSXMemberExpression",
105
+ "loc": {
106
+ "source": null,
107
+ "start": {
108
+ "line": 3,
109
+ "column": 10
110
+ },
111
+ "end": {
112
+ "line": 3,
113
+ "column": 17
114
+ }
115
+ },
116
+ "object": {
117
+ "type": "JSXIdentifier",
118
+ "loc": {
119
+ "source": null,
120
+ "start": {
121
+ "line": 3,
122
+ "column": 10
123
+ },
124
+ "end": {
125
+ "line": 3,
126
+ "column": 13
127
+ }
128
+ },
129
+ "name": "Foo",
130
+ "range": [
131
+ 28,
132
+ 31
133
+ ]
134
+ },
135
+ "property": {
136
+ "type": "JSXIdentifier",
137
+ "loc": {
138
+ "source": null,
139
+ "start": {
140
+ "line": 3,
141
+ "column": 14
142
+ },
143
+ "end": {
144
+ "line": 3,
145
+ "column": 17
146
+ }
147
+ },
148
+ "name": "Bar",
149
+ "range": [
150
+ 32,
151
+ 35
152
+ ]
153
+ },
154
+ "range": [
155
+ 28,
156
+ 35
157
+ ]
158
+ },
159
+ "attributes": [
160
+ {
161
+ "type": "JSXAttribute",
162
+ "loc": {
163
+ "source": null,
164
+ "start": {
165
+ "line": 3,
166
+ "column": 18
167
+ },
168
+ "end": {
169
+ "line": 3,
170
+ "column": 24
171
+ }
172
+ },
173
+ "name": {
174
+ "type": "JSXIdentifier",
175
+ "loc": {
176
+ "source": null,
177
+ "start": {
178
+ "line": 3,
179
+ "column": 18
180
+ },
181
+ "end": {
182
+ "line": 3,
183
+ "column": 19
184
+ }
185
+ },
186
+ "name": "a",
187
+ "range": [
188
+ 36,
189
+ 37
190
+ ]
191
+ },
192
+ "value": {
193
+ "type": "JSXExpressionContainer",
194
+ "loc": {
195
+ "source": null,
196
+ "start": {
197
+ "line": 3,
198
+ "column": 20
199
+ },
200
+ "end": {
201
+ "line": 3,
202
+ "column": 24
203
+ }
204
+ },
205
+ "expression": {
206
+ "type": "Literal",
207
+ "loc": {
208
+ "source": null,
209
+ "start": {
210
+ "line": 3,
211
+ "column": 21
212
+ },
213
+ "end": {
214
+ "line": 3,
215
+ "column": 23
216
+ }
217
+ },
218
+ "value": 10,
219
+ "range": [
220
+ 39,
221
+ 41
222
+ ],
223
+ "raw": "10"
224
+ },
225
+ "range": [
226
+ 38,
227
+ 42
228
+ ]
229
+ },
230
+ "range": [
231
+ 36,
232
+ 42
233
+ ]
234
+ }
235
+ ],
236
+ "selfClosing": false,
237
+ "range": [
238
+ 27,
239
+ 44
240
+ ]
241
+ },
242
+ "children": [],
243
+ "closingElement": {
244
+ "type": "JSXClosingElement",
245
+ "loc": {
246
+ "source": null,
247
+ "start": {
248
+ "line": 3,
249
+ "column": 26
250
+ },
251
+ "end": {
252
+ "line": 3,
253
+ "column": 36
254
+ }
255
+ },
256
+ "name": {
257
+ "type": "JSXMemberExpression",
258
+ "loc": {
259
+ "source": null,
260
+ "start": {
261
+ "line": 3,
262
+ "column": 28
263
+ },
264
+ "end": {
265
+ "line": 3,
266
+ "column": 35
267
+ }
268
+ },
269
+ "object": {
270
+ "type": "JSXIdentifier",
271
+ "loc": {
272
+ "source": null,
273
+ "start": {
274
+ "line": 3,
275
+ "column": 28
276
+ },
277
+ "end": {
278
+ "line": 3,
279
+ "column": 31
280
+ }
281
+ },
282
+ "name": "Foo",
283
+ "range": [
284
+ 46,
285
+ 49
286
+ ]
287
+ },
288
+ "property": {
289
+ "type": "JSXIdentifier",
290
+ "loc": {
291
+ "source": null,
292
+ "start": {
293
+ "line": 3,
294
+ "column": 32
295
+ },
296
+ "end": {
297
+ "line": 3,
298
+ "column": 35
299
+ }
300
+ },
301
+ "name": "Bar",
302
+ "range": [
303
+ 50,
304
+ 53
305
+ ]
306
+ },
307
+ "range": [
308
+ 46,
309
+ 53
310
+ ]
311
+ },
312
+ "range": [
313
+ 44,
314
+ 54
315
+ ]
316
+ },
317
+ "range": [
318
+ 27,
319
+ 54
320
+ ]
321
+ },
322
+ "range": [
323
+ 20,
324
+ 54
325
+ ]
326
+ }
327
+ ],
328
+ "range": [
329
+ 16,
330
+ 56
331
+ ]
332
+ },
333
+ "typeParameters": null,
334
+ "returnType": null,
335
+ "predicate": null,
336
+ "generator": false,
337
+ "async": false,
338
+ "range": [
339
+ 1,
340
+ 56
341
+ ]
342
+ }
343
+ ],
344
+ "comments": [],
345
+ "interpreter": null,
346
+ "range": [
347
+ 1,
348
+ 56
349
+ ],
350
+ "sourceType": "script"
351
+ }
\ No newline at end of file