json-as 1.0.0-alpha.1 → 1.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/.gitmodules +0 -0
  2. package/CHANGELOG +11 -0
  3. package/README.md +3 -2
  4. package/assembly/__benches__/misc.bench.ts +0 -19
  5. package/assembly/deserialize/simple/object.ts +2 -3
  6. package/assembly/index.ts +2 -7
  7. package/assembly/serialize/simd/string.ts +1 -1
  8. package/assembly/serialize/simple/array.ts +1 -1
  9. package/assembly/serialize/simple/bool.ts +1 -1
  10. package/assembly/serialize/simple/date.ts +1 -1
  11. package/assembly/serialize/simple/float.ts +1 -1
  12. package/assembly/serialize/simple/integer.ts +1 -1
  13. package/assembly/serialize/simple/map.ts +1 -1
  14. package/assembly/serialize/simple/string.ts +2 -2
  15. package/assembly/test.ts +8 -13
  16. package/modules/as-bs/LICENSE +21 -0
  17. package/modules/as-bs/README.md +95 -0
  18. package/modules/{bs → as-bs/assembly}/index.ts +11 -12
  19. package/modules/as-bs/assembly/tsconfig.json +97 -0
  20. package/modules/as-bs/index.ts +1 -0
  21. package/modules/as-bs/package.json +32 -0
  22. package/package.json +4 -5
  23. package/transform/lib/builder.js +1262 -1340
  24. package/transform/lib/index.js +512 -572
  25. package/transform/lib/index.js.map +1 -1
  26. package/transform/lib/linker.js +10 -12
  27. package/transform/lib/types.js +19 -18
  28. package/transform/lib/types.js.map +1 -1
  29. package/transform/lib/util.js +34 -34
  30. package/transform/lib/visitor.js +526 -529
  31. package/transform/package.json +2 -1
  32. package/transform/src/index.ts +19 -8
  33. package/transform/src/types.ts +1 -0
  34. package/modules/tsconfig.json +0 -8
  35. package/transform/lib/index.old.js +0 -404
  36. package/transform/lib/index.old.js.map +0 -1
@@ -1,531 +1,528 @@
1
1
  export class Visitor {
2
- currentSource = null;
3
- visit(node, ref = null) {
4
- if (node == null)
5
- return;
6
- if (node instanceof Array) {
7
- for (const n of node) {
8
- this._visit(n, ref);
9
- }
10
- }
11
- else {
12
- this._visit(node, ref);
13
- }
14
- }
15
- _visit(node, ref) {
16
- switch (node.kind) {
17
- case 0:
18
- this.visitSource(node, ref);
19
- break;
20
- case 1:
21
- this.visitNamedTypeNode(node, ref);
22
- break;
23
- case 2:
24
- this.visitFunctionTypeNode(node, ref);
25
- break;
26
- case 3:
27
- this.visitTypeName(node, ref);
28
- break;
29
- case 4:
30
- this.visitTypeParameter(node, ref);
31
- break;
32
- case 6:
33
- this.visitIdentifierExpression(node, ref);
34
- break;
35
- case 7:
36
- this.visitAssertionExpression(node, ref);
37
- break;
38
- case 8:
39
- this.visitBinaryExpression(node, ref);
40
- break;
41
- case 9:
42
- this.visitCallExpression(node, ref);
43
- break;
44
- case 10:
45
- this.visitClassExpression(node, ref);
46
- break;
47
- case 11:
48
- this.visitCommaExpression(node, ref);
49
- break;
50
- case 12:
51
- this.visitElementAccessExpression(node, ref);
52
- break;
53
- case 14:
54
- this.visitFunctionExpression(node, ref);
55
- break;
56
- case 15:
57
- this.visitInstanceOfExpression(node, ref);
58
- break;
59
- case 16:
60
- this.visitLiteralExpression(node, ref);
61
- break;
62
- case 17:
63
- this.visitNewExpression(node, ref);
64
- break;
65
- case 20:
66
- this.visitParenthesizedExpression(node, ref);
67
- break;
68
- case 21:
69
- this.visitPropertyAccessExpression(node, ref);
70
- break;
71
- case 22:
72
- this.visitTernaryExpression(node, ref);
73
- break;
74
- case 27:
75
- this.visitUnaryPostfixExpression(node, ref);
76
- break;
77
- case 28:
78
- this.visitUnaryPrefixExpression(node, ref);
79
- break;
80
- case 30:
81
- this.visitBlockStatement(node, ref);
82
- break;
83
- case 31:
84
- this.visitBreakStatement(node, ref);
85
- break;
86
- case 32:
87
- this.visitContinueStatement(node, ref);
88
- break;
89
- case 33:
90
- this.visitDoStatement(node, ref);
91
- break;
92
- case 34:
93
- this.visitEmptyStatement(node, ref);
94
- break;
95
- case 35:
96
- this.visitExportStatement(node, ref);
97
- break;
98
- case 36:
99
- this.visitExportDefaultStatement(node, ref);
100
- break;
101
- case 37:
102
- this.visitExportImportStatement(node, ref);
103
- break;
104
- case 38:
105
- this.visitExpressionStatement(node, ref);
106
- break;
107
- case 39:
108
- this.visitForStatement(node, ref);
109
- break;
110
- case 41:
111
- this.visitIfStatement(node, ref);
112
- break;
113
- case 42:
114
- this.visitImportStatement(node, ref);
115
- break;
116
- case 43:
117
- this.visitReturnStatement(node, ref);
118
- break;
119
- case 44:
120
- this.visitSwitchStatement(node, ref);
121
- break;
122
- case 45:
123
- this.visitThrowStatement(node, ref);
124
- break;
125
- case 46:
126
- this.visitTryStatement(node, ref);
127
- break;
128
- case 47:
129
- this.visitVariableStatement(node, ref);
130
- break;
131
- case 49:
132
- this.visitWhileStatement(node, ref);
133
- break;
134
- case 51:
135
- this.visitClassDeclaration(node, false, ref);
136
- break;
137
- case 52:
138
- this.visitEnumDeclaration(node, false, ref);
139
- break;
140
- case 53:
141
- this.visitEnumValueDeclaration(node, ref);
142
- break;
143
- case 54:
144
- this.visitFieldDeclaration(node, ref);
145
- break;
146
- case 55:
147
- this.visitFunctionDeclaration(node, false, ref);
148
- break;
149
- case 56:
150
- this.visitImportDeclaration(node, ref);
151
- break;
152
- case 57:
153
- this.visitInterfaceDeclaration(node, false, ref);
154
- break;
155
- case 58:
156
- this.visitMethodDeclaration(node, ref);
157
- break;
158
- case 59:
159
- this.visitNamespaceDeclaration(node, false, ref);
160
- break;
161
- case 60:
162
- this.visitTypeDeclaration(node, ref);
163
- break;
164
- case 61:
165
- this.visitVariableDeclaration(node, ref);
166
- break;
167
- case 62:
168
- this.visitDecoratorNode(node, ref);
169
- break;
170
- case 63:
171
- this.visitExportMember(node, ref);
172
- break;
173
- case 64:
174
- this.visitSwitchCase(node, ref);
175
- break;
176
- case 65:
177
- this.visitIndexSignature(node, ref);
178
- break;
179
- case 18:
180
- this.visitNullExpression(node, ref);
181
- break;
182
- case 25: {
183
- this.visitTrueExpression(node, ref);
184
- break;
185
- }
186
- case 13: {
187
- this.visitFalseExpression(node, ref);
188
- break;
189
- }
190
- case 29: {
191
- this.visitCompiledExpression(node, ref);
192
- break;
193
- }
194
- case 26: {
195
- this.visitConstructorExpression(node, ref);
196
- break;
197
- }
198
- case 66: {
199
- this.visitComment(node, ref);
200
- break;
201
- }
202
- case 40: {
203
- this.visitForOfStatement(node, ref);
204
- break;
205
- }
206
- case 50: {
207
- this.visitModuleDeclaration(node, ref);
208
- break;
209
- }
210
- case 19: {
211
- this.visitOmittedExpression(node, ref);
212
- break;
213
- }
214
- case 5: {
215
- this.visitParameter(node, ref);
216
- break;
217
- }
218
- case 23: {
219
- this.visitSuperExpression(node, ref);
220
- break;
221
- }
222
- case 24: {
223
- this.visitThisExpression(node, ref);
224
- break;
225
- }
226
- case 48: {
227
- this.visitVoidStatement(node, ref);
228
- break;
229
- }
230
- default:
231
- throw new Error("Could not visit invalid type!");
232
- }
233
- }
234
- visitSource(node, ref = null) {
235
- this.currentSource = node;
236
- this.visit(node.statements, node);
237
- this.currentSource = null;
238
- }
239
- visitTypeNode(node, ref = null) { }
240
- visitTypeName(node, ref = null) {
241
- this.visit(node.identifier, node);
242
- this.visit(node.next, node);
243
- }
244
- visitNamedTypeNode(node, ref = null) {
245
- this.visit(node.name, node);
246
- this.visit(node.typeArguments, node);
247
- }
248
- visitFunctionTypeNode(node, ref = null) {
249
- this.visit(node.parameters, node);
250
- this.visit(node.returnType, node);
251
- this.visit(node.explicitThisType, node);
252
- }
253
- visitTypeParameter(node, ref = null) {
254
- this.visit(node.name, node);
255
- this.visit(node.extendsType, node);
256
- this.visit(node.defaultType, node);
257
- }
258
- visitIdentifierExpression(node, ref = null) { }
259
- visitArrayLiteralExpression(node, ref = null) {
260
- this.visit(node.elementExpressions, node);
261
- }
262
- visitObjectLiteralExpression(node, ref = null) {
263
- this.visit(node.names, node);
264
- this.visit(node.values, node);
265
- }
266
- visitAssertionExpression(node, ref = null) {
267
- this.visit(node.toType, node);
268
- this.visit(node.expression, node);
269
- }
270
- visitBinaryExpression(node, ref = null) {
271
- this.visit(node.left, node);
272
- this.visit(node.right, node);
273
- }
274
- visitCallExpression(node, ref = null) {
275
- this.visit(node.expression, node);
276
- this.visit(node.typeArguments, node);
277
- this.visit(node.args, node);
278
- }
279
- visitClassExpression(node, ref = null) {
280
- this.visit(node.declaration, node);
281
- }
282
- visitCommaExpression(node, ref = null) {
283
- this.visit(node.expressions, node);
284
- }
285
- visitElementAccessExpression(node, ref = null) {
286
- this.visit(node.elementExpression, node);
287
- this.visit(node.expression, node);
288
- }
289
- visitFunctionExpression(node, ref = null) {
290
- this.visit(node.declaration, node);
291
- }
292
- visitLiteralExpression(node, ref = null) {
293
- switch (node.literalKind) {
294
- case 0:
295
- this.visitFloatLiteralExpression(node);
296
- break;
297
- case 1:
298
- this.visitIntegerLiteralExpression(node);
299
- break;
300
- case 2:
301
- this.visitStringLiteralExpression(node);
302
- break;
303
- case 3:
304
- this.visitTemplateLiteralExpression(node);
305
- break;
306
- case 4:
307
- this.visitRegexpLiteralExpression(node);
308
- break;
309
- case 5:
310
- this.visitArrayLiteralExpression(node);
311
- break;
312
- case 6:
313
- this.visitObjectLiteralExpression(node);
314
- break;
315
- default:
316
- throw new Error("Invalid LiteralKind at visitLiteralExpression(): " + node.literalKind);
317
- }
318
- }
319
- visitFloatLiteralExpression(node, ref = null) { }
320
- visitInstanceOfExpression(node, ref = null) {
321
- this.visit(node.expression, node);
322
- this.visit(node.isType, node);
323
- }
324
- visitIntegerLiteralExpression(node, ref = null) { }
325
- visitStringLiteralExpression(node, ref = null) { }
326
- visitTemplateLiteralExpression(node, ref = null) { }
327
- visitRegexpLiteralExpression(node, ref = null) { }
328
- visitNewExpression(node, ref = null) {
329
- this.visit(node.typeName, node);
330
- this.visit(node.typeArguments, node);
331
- this.visit(node.args, node);
332
- }
333
- visitParenthesizedExpression(node, ref = null) {
334
- this.visit(node.expression, node);
335
- }
336
- visitPropertyAccessExpression(node, ref = null) {
337
- this.visit(node.property, node);
338
- this.visit(node.expression, node);
339
- }
340
- visitTernaryExpression(node, ref = null) {
341
- this.visit(node.condition, node);
342
- this.visit(node.ifThen, node);
343
- this.visit(node.ifElse, node);
344
- }
345
- visitUnaryExpression(node, ref = null) {
346
- this.visit(node.operand, node);
347
- }
348
- visitUnaryPostfixExpression(node, ref = null) {
349
- this.visit(node.operand, node);
350
- }
351
- visitUnaryPrefixExpression(node, ref = null) {
352
- this.visit(node.operand, node);
353
- }
354
- visitSuperExpression(node, ref = null) { }
355
- visitFalseExpression(node, ref = null) { }
356
- visitTrueExpression(node, ref = null) { }
357
- visitThisExpression(node, ref = null) { }
358
- visitNullExpression(node, ref = null) { }
359
- visitConstructorExpression(node, ref = null) { }
360
- visitNodeAndTerminate(statement, ref = null) { }
361
- visitBlockStatement(node, ref = null) {
362
- this.visit(node.statements, node);
363
- }
364
- visitBreakStatement(node, ref = null) {
365
- this.visit(node.label, node);
366
- }
367
- visitContinueStatement(node, ref = null) {
368
- this.visit(node.label, node);
369
- }
370
- visitClassDeclaration(node, isDefault = false, ref = null) {
371
- this.visit(node.name, node);
372
- this.visit(node.decorators, node);
373
- if (node.isGeneric ? node.typeParameters != null : node.typeParameters == null) {
374
- this.visit(node.typeParameters, node);
375
- this.visit(node.extendsType, node);
376
- this.visit(node.implementsTypes, node);
377
- this.visit(node.members, node);
378
- }
379
- else {
380
- throw new Error("Expected to type parameters to match class declaration, but found type mismatch instead!");
381
- }
382
- }
383
- visitDoStatement(node, ref = null) {
384
- this.visit(node.condition, node);
385
- this.visit(node.body, node);
386
- }
387
- visitEmptyStatement(node, ref = null) { }
388
- visitEnumDeclaration(node, isDefault = false, ref = null) {
389
- this.visit(node.name, node);
390
- this.visit(node.decorators, node);
391
- this.visit(node.values, node);
392
- }
393
- visitEnumValueDeclaration(node, ref = null) {
394
- this.visit(node.name, node);
395
- this.visit(node.initializer, node);
396
- }
397
- visitExportImportStatement(node, ref = null) {
398
- this.visit(node.name, node);
399
- this.visit(node.externalName, node);
400
- }
401
- visitExportMember(node, ref = null) {
402
- this.visit(node.localName, node);
403
- this.visit(node.exportedName, node);
404
- }
405
- visitExportStatement(node, ref = null) {
406
- this.visit(node.path, node);
407
- this.visit(node.members, node);
408
- }
409
- visitExportDefaultStatement(node, ref = null) {
410
- this.visit(node.declaration, node);
411
- }
412
- visitExpressionStatement(node, ref = null) {
413
- this.visit(node.expression, ref);
414
- }
415
- visitFieldDeclaration(node, ref = null) {
416
- this.visit(node.name, node);
417
- this.visit(node.type, node);
418
- this.visit(node.initializer, node);
419
- this.visit(node.decorators, node);
420
- }
421
- visitForStatement(node, ref = null) {
422
- this.visit(node.initializer, node);
423
- this.visit(node.condition, node);
424
- this.visit(node.incrementor, node);
425
- this.visit(node.body, node);
426
- }
427
- visitFunctionDeclaration(node, isDefault = false, ref = null) {
428
- this.visit(node.name, node);
429
- this.visit(node.decorators, node);
430
- this.visit(node.typeParameters, node);
431
- this.visit(node.signature, node);
432
- this.visit(node.body, node);
433
- }
434
- visitIfStatement(node, ref = null) {
435
- this.visit(node.condition, node);
436
- this.visit(node.ifTrue, node);
437
- this.visit(node.ifFalse, node);
438
- }
439
- visitImportDeclaration(node, ref = null) {
440
- this.visit(node.foreignName, node);
441
- this.visit(node.name, node);
442
- this.visit(node.decorators, node);
443
- }
444
- visitImportStatement(node, ref = null) {
445
- this.visit(node.namespaceName, node);
446
- this.visit(node.declarations, node);
447
- }
448
- visitIndexSignature(node, ref = null) {
449
- this.visit(node.keyType, node);
450
- this.visit(node.valueType, node);
451
- }
452
- visitInterfaceDeclaration(node, isDefault = false, ref = null) {
453
- this.visit(node.name, node);
454
- this.visit(node.typeParameters, node);
455
- this.visit(node.implementsTypes, node);
456
- this.visit(node.extendsType, node);
457
- this.visit(node.members, node);
458
- }
459
- visitMethodDeclaration(node, ref = null) {
460
- this.visit(node.name, node);
461
- this.visit(node.typeParameters, node);
462
- this.visit(node.signature, node);
463
- this.visit(node.decorators, node);
464
- this.visit(node.body, node);
465
- }
466
- visitNamespaceDeclaration(node, isDefault = false, ref = null) {
467
- this.visit(node.name, node);
468
- this.visit(node.decorators, node);
469
- this.visit(node.members, node);
470
- }
471
- visitReturnStatement(node, ref = null) {
472
- this.visit(node.value, node);
473
- }
474
- visitSwitchCase(node, ref = null) {
475
- this.visit(node.label, node);
476
- this.visit(node.statements, node);
477
- }
478
- visitSwitchStatement(node, ref = null) {
479
- this.visit(node.condition, node);
480
- this.visit(node.cases, node);
481
- }
482
- visitThrowStatement(node, ref = null) {
483
- this.visit(node.value, node);
484
- }
485
- visitTryStatement(node, ref = null) {
486
- this.visit(node.bodyStatements, node);
487
- this.visit(node.catchVariable, node);
488
- this.visit(node.catchStatements, node);
489
- this.visit(node.finallyStatements, node);
490
- }
491
- visitTypeDeclaration(node, ref = null) {
492
- this.visit(node.name, node);
493
- this.visit(node.decorators, node);
494
- this.visit(node.type, node);
495
- this.visit(node.typeParameters, node);
496
- }
497
- visitVariableDeclaration(node, ref = null) {
498
- this.visit(node.name, node);
499
- this.visit(node.type, node);
500
- this.visit(node.initializer, node);
501
- }
502
- visitVariableStatement(node, ref = null) {
503
- this.visit(node.decorators, node);
504
- this.visit(node.declarations, node);
505
- }
506
- visitWhileStatement(node, ref = null) {
507
- this.visit(node.condition, node);
508
- this.visit(node.body, node);
509
- }
510
- visitVoidStatement(node, ref = null) { }
511
- visitComment(node, ref = null) { }
512
- visitDecoratorNode(node, ref = null) {
513
- this.visit(node.name, node);
514
- this.visit(node.args, node);
515
- }
516
- visitParameter(node, ref = null) {
517
- this.visit(node.name, node);
518
- this.visit(node.implicitFieldDeclaration, node);
519
- this.visit(node.initializer, node);
520
- this.visit(node.type, node);
521
- }
522
- visitCompiledExpression(node, ref = null) { }
523
- visitForOfStatement(node, ref = null) {
524
- this.visit(node.body, node);
525
- this.visit(node.variable, node);
526
- this.visit(node.iterable, node);
527
- }
528
- visitModuleDeclaration(node, ref = null) { }
529
- visitOmittedExpression(node, ref = null) { }
2
+ currentSource = null;
3
+ visit(node, ref = null) {
4
+ if (node == null) return;
5
+ if (node instanceof Array) {
6
+ for (const n of node) {
7
+ this._visit(n, ref);
8
+ }
9
+ } else {
10
+ this._visit(node, ref);
11
+ }
12
+ }
13
+ _visit(node, ref) {
14
+ switch (node.kind) {
15
+ case 0:
16
+ this.visitSource(node, ref);
17
+ break;
18
+ case 1:
19
+ this.visitNamedTypeNode(node, ref);
20
+ break;
21
+ case 2:
22
+ this.visitFunctionTypeNode(node, ref);
23
+ break;
24
+ case 3:
25
+ this.visitTypeName(node, ref);
26
+ break;
27
+ case 4:
28
+ this.visitTypeParameter(node, ref);
29
+ break;
30
+ case 6:
31
+ this.visitIdentifierExpression(node, ref);
32
+ break;
33
+ case 7:
34
+ this.visitAssertionExpression(node, ref);
35
+ break;
36
+ case 8:
37
+ this.visitBinaryExpression(node, ref);
38
+ break;
39
+ case 9:
40
+ this.visitCallExpression(node, ref);
41
+ break;
42
+ case 10:
43
+ this.visitClassExpression(node, ref);
44
+ break;
45
+ case 11:
46
+ this.visitCommaExpression(node, ref);
47
+ break;
48
+ case 12:
49
+ this.visitElementAccessExpression(node, ref);
50
+ break;
51
+ case 14:
52
+ this.visitFunctionExpression(node, ref);
53
+ break;
54
+ case 15:
55
+ this.visitInstanceOfExpression(node, ref);
56
+ break;
57
+ case 16:
58
+ this.visitLiteralExpression(node, ref);
59
+ break;
60
+ case 17:
61
+ this.visitNewExpression(node, ref);
62
+ break;
63
+ case 20:
64
+ this.visitParenthesizedExpression(node, ref);
65
+ break;
66
+ case 21:
67
+ this.visitPropertyAccessExpression(node, ref);
68
+ break;
69
+ case 22:
70
+ this.visitTernaryExpression(node, ref);
71
+ break;
72
+ case 27:
73
+ this.visitUnaryPostfixExpression(node, ref);
74
+ break;
75
+ case 28:
76
+ this.visitUnaryPrefixExpression(node, ref);
77
+ break;
78
+ case 30:
79
+ this.visitBlockStatement(node, ref);
80
+ break;
81
+ case 31:
82
+ this.visitBreakStatement(node, ref);
83
+ break;
84
+ case 32:
85
+ this.visitContinueStatement(node, ref);
86
+ break;
87
+ case 33:
88
+ this.visitDoStatement(node, ref);
89
+ break;
90
+ case 34:
91
+ this.visitEmptyStatement(node, ref);
92
+ break;
93
+ case 35:
94
+ this.visitExportStatement(node, ref);
95
+ break;
96
+ case 36:
97
+ this.visitExportDefaultStatement(node, ref);
98
+ break;
99
+ case 37:
100
+ this.visitExportImportStatement(node, ref);
101
+ break;
102
+ case 38:
103
+ this.visitExpressionStatement(node, ref);
104
+ break;
105
+ case 39:
106
+ this.visitForStatement(node, ref);
107
+ break;
108
+ case 41:
109
+ this.visitIfStatement(node, ref);
110
+ break;
111
+ case 42:
112
+ this.visitImportStatement(node, ref);
113
+ break;
114
+ case 43:
115
+ this.visitReturnStatement(node, ref);
116
+ break;
117
+ case 44:
118
+ this.visitSwitchStatement(node, ref);
119
+ break;
120
+ case 45:
121
+ this.visitThrowStatement(node, ref);
122
+ break;
123
+ case 46:
124
+ this.visitTryStatement(node, ref);
125
+ break;
126
+ case 47:
127
+ this.visitVariableStatement(node, ref);
128
+ break;
129
+ case 49:
130
+ this.visitWhileStatement(node, ref);
131
+ break;
132
+ case 51:
133
+ this.visitClassDeclaration(node, false, ref);
134
+ break;
135
+ case 52:
136
+ this.visitEnumDeclaration(node, false, ref);
137
+ break;
138
+ case 53:
139
+ this.visitEnumValueDeclaration(node, ref);
140
+ break;
141
+ case 54:
142
+ this.visitFieldDeclaration(node, ref);
143
+ break;
144
+ case 55:
145
+ this.visitFunctionDeclaration(node, false, ref);
146
+ break;
147
+ case 56:
148
+ this.visitImportDeclaration(node, ref);
149
+ break;
150
+ case 57:
151
+ this.visitInterfaceDeclaration(node, false, ref);
152
+ break;
153
+ case 58:
154
+ this.visitMethodDeclaration(node, ref);
155
+ break;
156
+ case 59:
157
+ this.visitNamespaceDeclaration(node, false, ref);
158
+ break;
159
+ case 60:
160
+ this.visitTypeDeclaration(node, ref);
161
+ break;
162
+ case 61:
163
+ this.visitVariableDeclaration(node, ref);
164
+ break;
165
+ case 62:
166
+ this.visitDecoratorNode(node, ref);
167
+ break;
168
+ case 63:
169
+ this.visitExportMember(node, ref);
170
+ break;
171
+ case 64:
172
+ this.visitSwitchCase(node, ref);
173
+ break;
174
+ case 65:
175
+ this.visitIndexSignature(node, ref);
176
+ break;
177
+ case 18:
178
+ this.visitNullExpression(node, ref);
179
+ break;
180
+ case 25: {
181
+ this.visitTrueExpression(node, ref);
182
+ break;
183
+ }
184
+ case 13: {
185
+ this.visitFalseExpression(node, ref);
186
+ break;
187
+ }
188
+ case 29: {
189
+ this.visitCompiledExpression(node, ref);
190
+ break;
191
+ }
192
+ case 26: {
193
+ this.visitConstructorExpression(node, ref);
194
+ break;
195
+ }
196
+ case 66: {
197
+ this.visitComment(node, ref);
198
+ break;
199
+ }
200
+ case 40: {
201
+ this.visitForOfStatement(node, ref);
202
+ break;
203
+ }
204
+ case 50: {
205
+ this.visitModuleDeclaration(node, ref);
206
+ break;
207
+ }
208
+ case 19: {
209
+ this.visitOmittedExpression(node, ref);
210
+ break;
211
+ }
212
+ case 5: {
213
+ this.visitParameter(node, ref);
214
+ break;
215
+ }
216
+ case 23: {
217
+ this.visitSuperExpression(node, ref);
218
+ break;
219
+ }
220
+ case 24: {
221
+ this.visitThisExpression(node, ref);
222
+ break;
223
+ }
224
+ case 48: {
225
+ this.visitVoidStatement(node, ref);
226
+ break;
227
+ }
228
+ default:
229
+ throw new Error("Could not visit invalid type!");
230
+ }
231
+ }
232
+ visitSource(node, ref = null) {
233
+ this.currentSource = node;
234
+ this.visit(node.statements, node);
235
+ this.currentSource = null;
236
+ }
237
+ visitTypeNode(node, ref = null) {}
238
+ visitTypeName(node, ref = null) {
239
+ this.visit(node.identifier, node);
240
+ this.visit(node.next, node);
241
+ }
242
+ visitNamedTypeNode(node, ref = null) {
243
+ this.visit(node.name, node);
244
+ this.visit(node.typeArguments, node);
245
+ }
246
+ visitFunctionTypeNode(node, ref = null) {
247
+ this.visit(node.parameters, node);
248
+ this.visit(node.returnType, node);
249
+ this.visit(node.explicitThisType, node);
250
+ }
251
+ visitTypeParameter(node, ref = null) {
252
+ this.visit(node.name, node);
253
+ this.visit(node.extendsType, node);
254
+ this.visit(node.defaultType, node);
255
+ }
256
+ visitIdentifierExpression(node, ref = null) {}
257
+ visitArrayLiteralExpression(node, ref = null) {
258
+ this.visit(node.elementExpressions, node);
259
+ }
260
+ visitObjectLiteralExpression(node, ref = null) {
261
+ this.visit(node.names, node);
262
+ this.visit(node.values, node);
263
+ }
264
+ visitAssertionExpression(node, ref = null) {
265
+ this.visit(node.toType, node);
266
+ this.visit(node.expression, node);
267
+ }
268
+ visitBinaryExpression(node, ref = null) {
269
+ this.visit(node.left, node);
270
+ this.visit(node.right, node);
271
+ }
272
+ visitCallExpression(node, ref = null) {
273
+ this.visit(node.expression, node);
274
+ this.visit(node.typeArguments, node);
275
+ this.visit(node.args, node);
276
+ }
277
+ visitClassExpression(node, ref = null) {
278
+ this.visit(node.declaration, node);
279
+ }
280
+ visitCommaExpression(node, ref = null) {
281
+ this.visit(node.expressions, node);
282
+ }
283
+ visitElementAccessExpression(node, ref = null) {
284
+ this.visit(node.elementExpression, node);
285
+ this.visit(node.expression, node);
286
+ }
287
+ visitFunctionExpression(node, ref = null) {
288
+ this.visit(node.declaration, node);
289
+ }
290
+ visitLiteralExpression(node, ref = null) {
291
+ switch (node.literalKind) {
292
+ case 0:
293
+ this.visitFloatLiteralExpression(node);
294
+ break;
295
+ case 1:
296
+ this.visitIntegerLiteralExpression(node);
297
+ break;
298
+ case 2:
299
+ this.visitStringLiteralExpression(node);
300
+ break;
301
+ case 3:
302
+ this.visitTemplateLiteralExpression(node);
303
+ break;
304
+ case 4:
305
+ this.visitRegexpLiteralExpression(node);
306
+ break;
307
+ case 5:
308
+ this.visitArrayLiteralExpression(node);
309
+ break;
310
+ case 6:
311
+ this.visitObjectLiteralExpression(node);
312
+ break;
313
+ default:
314
+ throw new Error("Invalid LiteralKind at visitLiteralExpression(): " + node.literalKind);
315
+ }
316
+ }
317
+ visitFloatLiteralExpression(node, ref = null) {}
318
+ visitInstanceOfExpression(node, ref = null) {
319
+ this.visit(node.expression, node);
320
+ this.visit(node.isType, node);
321
+ }
322
+ visitIntegerLiteralExpression(node, ref = null) {}
323
+ visitStringLiteralExpression(node, ref = null) {}
324
+ visitTemplateLiteralExpression(node, ref = null) {}
325
+ visitRegexpLiteralExpression(node, ref = null) {}
326
+ visitNewExpression(node, ref = null) {
327
+ this.visit(node.typeName, node);
328
+ this.visit(node.typeArguments, node);
329
+ this.visit(node.args, node);
330
+ }
331
+ visitParenthesizedExpression(node, ref = null) {
332
+ this.visit(node.expression, node);
333
+ }
334
+ visitPropertyAccessExpression(node, ref = null) {
335
+ this.visit(node.property, node);
336
+ this.visit(node.expression, node);
337
+ }
338
+ visitTernaryExpression(node, ref = null) {
339
+ this.visit(node.condition, node);
340
+ this.visit(node.ifThen, node);
341
+ this.visit(node.ifElse, node);
342
+ }
343
+ visitUnaryExpression(node, ref = null) {
344
+ this.visit(node.operand, node);
345
+ }
346
+ visitUnaryPostfixExpression(node, ref = null) {
347
+ this.visit(node.operand, node);
348
+ }
349
+ visitUnaryPrefixExpression(node, ref = null) {
350
+ this.visit(node.operand, node);
351
+ }
352
+ visitSuperExpression(node, ref = null) {}
353
+ visitFalseExpression(node, ref = null) {}
354
+ visitTrueExpression(node, ref = null) {}
355
+ visitThisExpression(node, ref = null) {}
356
+ visitNullExpression(node, ref = null) {}
357
+ visitConstructorExpression(node, ref = null) {}
358
+ visitNodeAndTerminate(statement, ref = null) {}
359
+ visitBlockStatement(node, ref = null) {
360
+ this.visit(node.statements, node);
361
+ }
362
+ visitBreakStatement(node, ref = null) {
363
+ this.visit(node.label, node);
364
+ }
365
+ visitContinueStatement(node, ref = null) {
366
+ this.visit(node.label, node);
367
+ }
368
+ visitClassDeclaration(node, isDefault = false, ref = null) {
369
+ this.visit(node.name, node);
370
+ this.visit(node.decorators, node);
371
+ if (node.isGeneric ? node.typeParameters != null : node.typeParameters == null) {
372
+ this.visit(node.typeParameters, node);
373
+ this.visit(node.extendsType, node);
374
+ this.visit(node.implementsTypes, node);
375
+ this.visit(node.members, node);
376
+ } else {
377
+ throw new Error("Expected to type parameters to match class declaration, but found type mismatch instead!");
378
+ }
379
+ }
380
+ visitDoStatement(node, ref = null) {
381
+ this.visit(node.condition, node);
382
+ this.visit(node.body, node);
383
+ }
384
+ visitEmptyStatement(node, ref = null) {}
385
+ visitEnumDeclaration(node, isDefault = false, ref = null) {
386
+ this.visit(node.name, node);
387
+ this.visit(node.decorators, node);
388
+ this.visit(node.values, node);
389
+ }
390
+ visitEnumValueDeclaration(node, ref = null) {
391
+ this.visit(node.name, node);
392
+ this.visit(node.initializer, node);
393
+ }
394
+ visitExportImportStatement(node, ref = null) {
395
+ this.visit(node.name, node);
396
+ this.visit(node.externalName, node);
397
+ }
398
+ visitExportMember(node, ref = null) {
399
+ this.visit(node.localName, node);
400
+ this.visit(node.exportedName, node);
401
+ }
402
+ visitExportStatement(node, ref = null) {
403
+ this.visit(node.path, node);
404
+ this.visit(node.members, node);
405
+ }
406
+ visitExportDefaultStatement(node, ref = null) {
407
+ this.visit(node.declaration, node);
408
+ }
409
+ visitExpressionStatement(node, ref = null) {
410
+ this.visit(node.expression, ref);
411
+ }
412
+ visitFieldDeclaration(node, ref = null) {
413
+ this.visit(node.name, node);
414
+ this.visit(node.type, node);
415
+ this.visit(node.initializer, node);
416
+ this.visit(node.decorators, node);
417
+ }
418
+ visitForStatement(node, ref = null) {
419
+ this.visit(node.initializer, node);
420
+ this.visit(node.condition, node);
421
+ this.visit(node.incrementor, node);
422
+ this.visit(node.body, node);
423
+ }
424
+ visitFunctionDeclaration(node, isDefault = false, ref = null) {
425
+ this.visit(node.name, node);
426
+ this.visit(node.decorators, node);
427
+ this.visit(node.typeParameters, node);
428
+ this.visit(node.signature, node);
429
+ this.visit(node.body, node);
430
+ }
431
+ visitIfStatement(node, ref = null) {
432
+ this.visit(node.condition, node);
433
+ this.visit(node.ifTrue, node);
434
+ this.visit(node.ifFalse, node);
435
+ }
436
+ visitImportDeclaration(node, ref = null) {
437
+ this.visit(node.foreignName, node);
438
+ this.visit(node.name, node);
439
+ this.visit(node.decorators, node);
440
+ }
441
+ visitImportStatement(node, ref = null) {
442
+ this.visit(node.namespaceName, node);
443
+ this.visit(node.declarations, node);
444
+ }
445
+ visitIndexSignature(node, ref = null) {
446
+ this.visit(node.keyType, node);
447
+ this.visit(node.valueType, node);
448
+ }
449
+ visitInterfaceDeclaration(node, isDefault = false, ref = null) {
450
+ this.visit(node.name, node);
451
+ this.visit(node.typeParameters, node);
452
+ this.visit(node.implementsTypes, node);
453
+ this.visit(node.extendsType, node);
454
+ this.visit(node.members, node);
455
+ }
456
+ visitMethodDeclaration(node, ref = null) {
457
+ this.visit(node.name, node);
458
+ this.visit(node.typeParameters, node);
459
+ this.visit(node.signature, node);
460
+ this.visit(node.decorators, node);
461
+ this.visit(node.body, node);
462
+ }
463
+ visitNamespaceDeclaration(node, isDefault = false, ref = null) {
464
+ this.visit(node.name, node);
465
+ this.visit(node.decorators, node);
466
+ this.visit(node.members, node);
467
+ }
468
+ visitReturnStatement(node, ref = null) {
469
+ this.visit(node.value, node);
470
+ }
471
+ visitSwitchCase(node, ref = null) {
472
+ this.visit(node.label, node);
473
+ this.visit(node.statements, node);
474
+ }
475
+ visitSwitchStatement(node, ref = null) {
476
+ this.visit(node.condition, node);
477
+ this.visit(node.cases, node);
478
+ }
479
+ visitThrowStatement(node, ref = null) {
480
+ this.visit(node.value, node);
481
+ }
482
+ visitTryStatement(node, ref = null) {
483
+ this.visit(node.bodyStatements, node);
484
+ this.visit(node.catchVariable, node);
485
+ this.visit(node.catchStatements, node);
486
+ this.visit(node.finallyStatements, node);
487
+ }
488
+ visitTypeDeclaration(node, ref = null) {
489
+ this.visit(node.name, node);
490
+ this.visit(node.decorators, node);
491
+ this.visit(node.type, node);
492
+ this.visit(node.typeParameters, node);
493
+ }
494
+ visitVariableDeclaration(node, ref = null) {
495
+ this.visit(node.name, node);
496
+ this.visit(node.type, node);
497
+ this.visit(node.initializer, node);
498
+ }
499
+ visitVariableStatement(node, ref = null) {
500
+ this.visit(node.decorators, node);
501
+ this.visit(node.declarations, node);
502
+ }
503
+ visitWhileStatement(node, ref = null) {
504
+ this.visit(node.condition, node);
505
+ this.visit(node.body, node);
506
+ }
507
+ visitVoidStatement(node, ref = null) {}
508
+ visitComment(node, ref = null) {}
509
+ visitDecoratorNode(node, ref = null) {
510
+ this.visit(node.name, node);
511
+ this.visit(node.args, node);
512
+ }
513
+ visitParameter(node, ref = null) {
514
+ this.visit(node.name, node);
515
+ this.visit(node.implicitFieldDeclaration, node);
516
+ this.visit(node.initializer, node);
517
+ this.visit(node.type, node);
518
+ }
519
+ visitCompiledExpression(node, ref = null) {}
520
+ visitForOfStatement(node, ref = null) {
521
+ this.visit(node.body, node);
522
+ this.visit(node.variable, node);
523
+ this.visit(node.iterable, node);
524
+ }
525
+ visitModuleDeclaration(node, ref = null) {}
526
+ visitOmittedExpression(node, ref = null) {}
530
527
  }
531
- //# sourceMappingURL=visitor.js.map
528
+ //# sourceMappingURL=visitor.js.map