json-as 0.9.8 → 0.9.9-a

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 (63) hide show
  1. package/.github/workflows/nodejs.yml +9 -10
  2. package/CHANGELOG +13 -1
  3. package/README.md +56 -8
  4. package/asconfig.json +24 -3
  5. package/assembly/__tests__/test.spec.ts +564 -0
  6. package/assembly/__tests__/types.ts +82 -0
  7. package/assembly/{src/chars.ts → chars.ts} +36 -36
  8. package/assembly/deserialize/array/array.ts +4 -4
  9. package/assembly/deserialize/array/bool.ts +4 -4
  10. package/assembly/deserialize/array/float.ts +4 -4
  11. package/assembly/deserialize/array/integer.ts +4 -4
  12. package/assembly/deserialize/array/map.ts +4 -4
  13. package/assembly/deserialize/array/object.ts +4 -4
  14. package/assembly/deserialize/array/string.ts +4 -4
  15. package/assembly/deserialize/array.ts +5 -4
  16. package/assembly/deserialize/bool.ts +4 -4
  17. package/assembly/deserialize/date.ts +2 -2
  18. package/assembly/deserialize/float.ts +2 -2
  19. package/assembly/deserialize/integer.ts +3 -3
  20. package/assembly/deserialize/map.ts +6 -4
  21. package/assembly/deserialize/mpz.ts +12 -0
  22. package/assembly/deserialize/object.ts +4 -4
  23. package/assembly/deserialize/string.ts +5 -5
  24. package/assembly/index.ts +25 -23
  25. package/assembly/serialize/array.ts +6 -5
  26. package/assembly/serialize/bool.ts +2 -2
  27. package/assembly/serialize/date.ts +2 -2
  28. package/assembly/serialize/float.ts +2 -2
  29. package/assembly/serialize/integer.ts +2 -2
  30. package/assembly/serialize/map.ts +8 -7
  31. package/assembly/serialize/mpz.ts +6 -0
  32. package/assembly/serialize/object.ts +2 -2
  33. package/assembly/serialize/string.ts +5 -5
  34. package/assembly/serialize/unknown.ts +5 -5
  35. package/assembly/test.ts +70 -43
  36. package/assembly/types.ts +4 -0
  37. package/assembly/{src/util.ts → util.ts} +3 -3
  38. package/bench/benchmark.ts +1 -1
  39. package/build/test.spec.wasm +0 -0
  40. package/build/test.spec.wasm.map +1 -0
  41. package/build/test.spec.wat +112683 -0
  42. package/build/test.wasm +0 -0
  43. package/build/test.wasm.map +1 -0
  44. package/build/test.wat +30110 -0
  45. package/package.json +13 -13
  46. package/transform/lib/index.js +26 -0
  47. package/transform/lib/visitor.js +516 -0
  48. package/transform/package.json +1 -1
  49. package/transform/src/index.ts +24 -0
  50. package/transform/src/visitor.ts +543 -0
  51. package/transform/tsconfig.json +23 -63
  52. package/tsconfig.json +13 -13
  53. package/as-pect.asconfig.json +0 -24
  54. package/as-pect.config.js +0 -30
  55. package/assembly/__tests__/deserialize.spec.ts +0 -301
  56. package/assembly/__tests__/serialize.spec.ts +0 -398
  57. package/assembly/deserialize/box.ts +0 -17
  58. package/assembly/serialize/box.ts +0 -11
  59. package/develop/assembly/serialize/unknown.ts +0 -46
  60. package/transform/lib/index.old.js +0 -257
  61. package/transform/lib/types.js +0 -17
  62. package/transform/src/index.old.ts +0 -312
  63. /package/assembly/{src/sink.ts → sink.ts} +0 -0
@@ -0,0 +1,543 @@
1
+ import {
2
+ ArrayLiteralExpression,
3
+ AssertionExpression,
4
+ BinaryExpression,
5
+ CallExpression,
6
+ ElementAccessExpression,
7
+ FloatLiteralExpression,
8
+ FunctionTypeNode,
9
+ IdentifierExpression,
10
+ NamedTypeNode,
11
+ Node,
12
+ ObjectLiteralExpression,
13
+ Source,
14
+ TypeNode,
15
+ TypeParameterNode,
16
+ BlockStatement,
17
+ BreakStatement,
18
+ ClassDeclaration,
19
+ ClassExpression,
20
+ CommaExpression,
21
+ ConstructorExpression,
22
+ ContinueStatement,
23
+ DecoratorNode,
24
+ DoStatement,
25
+ EmptyStatement,
26
+ EnumDeclaration,
27
+ EnumValueDeclaration,
28
+ ExportDefaultStatement,
29
+ ExportImportStatement,
30
+ ExportMember,
31
+ ExportStatement,
32
+ Expression,
33
+ ExpressionStatement,
34
+ FalseExpression,
35
+ FieldDeclaration,
36
+ ForStatement,
37
+ FunctionDeclaration,
38
+ FunctionExpression,
39
+ IfStatement,
40
+ ImportDeclaration,
41
+ ImportStatement,
42
+ IndexSignatureNode,
43
+ InstanceOfExpression,
44
+ IntegerLiteralExpression,
45
+ InterfaceDeclaration,
46
+ LiteralExpression,
47
+ MethodDeclaration,
48
+ NamespaceDeclaration,
49
+ NewExpression,
50
+ NullExpression,
51
+ ParameterNode,
52
+ ParenthesizedExpression,
53
+ PropertyAccessExpression,
54
+ RegexpLiteralExpression,
55
+ ReturnStatement,
56
+ Statement,
57
+ StringLiteralExpression,
58
+ SuperExpression,
59
+ SwitchCase,
60
+ SwitchStatement,
61
+ TemplateLiteralExpression,
62
+ TernaryExpression,
63
+ ThisExpression,
64
+ ThrowStatement,
65
+ TrueExpression,
66
+ TryStatement,
67
+ TypeDeclaration,
68
+ TypeName,
69
+ UnaryExpression,
70
+ UnaryPostfixExpression,
71
+ UnaryPrefixExpression,
72
+ VariableDeclaration,
73
+ VariableStatement,
74
+ VoidStatement,
75
+ WhileStatement,
76
+ } from "assemblyscript/dist/assemblyscript.js";
77
+
78
+ export declare type Collection<T extends unknown> =
79
+ | Node
80
+ | T[]
81
+ | Map<string, T | T[] | Iterable<T>>
82
+ | Iterable<T>;
83
+
84
+ export class Visitor {
85
+ public currentSource: Source | null = null;
86
+ public depth = 0;
87
+ visit<T extends unknown>(node: T | T[] | Map<string, T | T[] | Iterable<T>> | Iterable<T>): void {
88
+ if (node == null) {
89
+ return;
90
+ } else if (node instanceof Array) {
91
+ for (const element of node) {
92
+ this.visit(element);
93
+ }
94
+ } else if (node instanceof Map) {
95
+ for (const element of node.values()) {
96
+ this.visit(element);
97
+ }
98
+ // @ts-ignore
99
+ } else if (typeof node[Symbol.iterator] === "function") {
100
+ // @ts-ignore
101
+ for (const element of node) {
102
+ this.visit(element);
103
+ }
104
+ } else if (node instanceof Node) {
105
+ this._visit(node);
106
+ } else {
107
+ throw new Error("Could not visit invalid type!");
108
+ }
109
+ }
110
+ private _visit(node: Node): void {
111
+ if (node instanceof Source) {
112
+ this.visitSource(node);
113
+ } else if (node instanceof NamedTypeNode) {
114
+ this.visitNamedTypeNode(node);
115
+ } else if (node instanceof FunctionTypeNode) {
116
+ this.visitFunctionTypeNode(node);
117
+ } else if (node instanceof TypeName) {
118
+ this.visitTypeName(node);
119
+ } else if (node instanceof TypeParameterNode) {
120
+ this.visitTypeParameter(node);
121
+ } else if (node instanceof IdentifierExpression) {
122
+ this.visitIdentifierExpression(node);
123
+ } else if (node instanceof AssertionExpression) {
124
+ this.visitAssertionExpression(node);
125
+ } else if (node instanceof BinaryExpression) {
126
+ this.visitBinaryExpression(node);
127
+ } else if (node instanceof CallExpression) {
128
+ this.visitCallExpression(node);
129
+ } else if (node instanceof ClassExpression) {
130
+ this.visitClassExpression(node);
131
+ } else if (node instanceof CommaExpression) {
132
+ this.visitCommaExpression(node);
133
+ } else if (node instanceof ElementAccessExpression) {
134
+ this.visitElementAccessExpression(node);
135
+ } else if (node instanceof FunctionExpression) {
136
+ this.visitFunctionExpression(node);
137
+ } else if (node instanceof InstanceOfExpression) {
138
+ this.visitInstanceOfExpression(node);
139
+ } else if (node instanceof LiteralExpression) {
140
+ this.visitLiteralExpression(node);
141
+ } else if (node instanceof NewExpression) {
142
+ this.visitNewExpression(node);
143
+ } else if (node instanceof ParenthesizedExpression) {
144
+ this.visitParenthesizedExpression(node);
145
+ } else if (node instanceof PropertyAccessExpression) {
146
+ this.visitPropertyAccessExpression(node);
147
+ } else if (node instanceof TernaryExpression) {
148
+ this.visitTernaryExpression(node);
149
+ } else if (node instanceof UnaryPostfixExpression) {
150
+ this.visitUnaryPostfixExpression(node);
151
+ } else if (node instanceof UnaryPrefixExpression) {
152
+ this.visitUnaryPrefixExpression(node);
153
+ } else if (node instanceof BlockStatement) {
154
+ this.visitBlockStatement(node);
155
+ } else if (node instanceof BreakStatement) {
156
+ this.visitBreakStatement(node);
157
+ } else if (node instanceof ContinueStatement) {
158
+ this.visitContinueStatement(node);
159
+ } else if (node instanceof DoStatement) {
160
+ this.visitDoStatement(node);
161
+ } else if (node instanceof EmptyStatement) {
162
+ this.visitEmptyStatement(node);
163
+ } else if (node instanceof ExportStatement) {
164
+ this.visitExportStatement(node);
165
+ } else if (node instanceof ExportDefaultStatement) {
166
+ this.visitExportDefaultStatement(node);
167
+ } else if (node instanceof ExportImportStatement) {
168
+ this.visitExportImportStatement(node);
169
+ } else if (node instanceof ExpressionStatement) {
170
+ this.visitExpressionStatement(node);
171
+ } else if (node instanceof ForStatement) {
172
+ this.visitForStatement(node);
173
+ } else if (node instanceof IfStatement) {
174
+ this.visitIfStatement(node);
175
+ } else if (node instanceof ImportStatement) {
176
+ this.visitImportStatement(node);
177
+ } else if (node instanceof ReturnStatement) {
178
+ this.visitReturnStatement(node);
179
+ } else if (node instanceof SwitchStatement) {
180
+ this.visitSwitchStatement(node);
181
+ } else if (node instanceof ThrowStatement) {
182
+ this.visitThrowStatement(node);
183
+ } else if (node instanceof TryStatement) {
184
+ this.visitTryStatement(node);
185
+ } else if (node instanceof VariableStatement) {
186
+ this.visitVariableStatement(node);
187
+ } else if (node instanceof WhileStatement) {
188
+ this.visitWhileStatement(node);
189
+ } else if (node instanceof ClassDeclaration) {
190
+ this.visitClassDeclaration(node);
191
+ } else if (node instanceof EnumDeclaration) {
192
+ this.visitEnumDeclaration(node);
193
+ } else if (node instanceof EnumValueDeclaration) {
194
+ this.visitEnumValueDeclaration(node);
195
+ } else if (node instanceof FieldDeclaration) {
196
+ this.visitFieldDeclaration(node);
197
+ } else if (node instanceof FunctionDeclaration) {
198
+ this.visitFunctionDeclaration(node);
199
+ } else if (node instanceof ImportDeclaration) {
200
+ this.visitImportDeclaration(node);
201
+ } else if (node instanceof InterfaceDeclaration) {
202
+ this.visitInterfaceDeclaration(node);
203
+ } else if (node instanceof MethodDeclaration) {
204
+ this.visitMethodDeclaration(node);
205
+ } else if (node instanceof NamespaceDeclaration) {
206
+ this.visitNamespaceDeclaration(node);
207
+ } else if (node instanceof TypeDeclaration) {
208
+ this.visitTypeDeclaration(node);
209
+ } else if (node instanceof VariableDeclaration) {
210
+ this.visitVariableDeclaration(node);
211
+ } else if (node instanceof DecoratorNode) {
212
+ this.visitDecoratorNode(node);
213
+ } else if (node instanceof ExportMember) {
214
+ this.visitExportMember(node);
215
+ } else if (node instanceof ParameterNode) {
216
+ this.visitParameter(node);
217
+ } else if (node instanceof SwitchCase) {
218
+ this.visitSwitchCase(node);
219
+ } else if (node instanceof IndexSignatureNode) {
220
+ this.visitIndexSignature(node);
221
+ } else {
222
+ throw new Error("Could not visit invalid type!");
223
+ }
224
+ }
225
+ visitSource(node: Source): void {
226
+ this.currentSource = node;
227
+ for (const stmt of node.statements) {
228
+ this.depth++;
229
+ this._visit(stmt);
230
+ this.depth--;
231
+ }
232
+ this.currentSource = null;
233
+ }
234
+ visitTypeNode(node: TypeNode): void { }
235
+ visitTypeName(node: TypeName): void {
236
+ this.visit(node.identifier);
237
+ this.visit(node.next);
238
+ }
239
+ visitNamedTypeNode(node: NamedTypeNode): void {
240
+ this.visit(node.name);
241
+ this.visit(node.typeArguments);
242
+ }
243
+ visitFunctionTypeNode(node: FunctionTypeNode): void {
244
+ this.visit(node.parameters);
245
+ this.visit(node.returnType);
246
+ this.visit(node.explicitThisType);
247
+ }
248
+ visitTypeParameter(node: TypeParameterNode): void {
249
+ this.visit(node.name);
250
+ this.visit(node.extendsType);
251
+ this.visit(node.defaultType);
252
+ }
253
+ visitIdentifierExpression(node: IdentifierExpression): void { }
254
+ visitArrayLiteralExpression(node: ArrayLiteralExpression) {
255
+ this.visit(node.elementExpressions);
256
+ }
257
+ visitObjectLiteralExpression(node: ObjectLiteralExpression) {
258
+ this.visit(node.names);
259
+ this.visit(node.values);
260
+ }
261
+ visitAssertionExpression(node: AssertionExpression) {
262
+ this.visit(node.toType);
263
+ this.visit(node.expression);
264
+ }
265
+ visitBinaryExpression(node: BinaryExpression) {
266
+ this.visit(node.left);
267
+ this.visit(node.right);
268
+ }
269
+ visitCallExpression(node: CallExpression) {
270
+ this.visit(node.expression);
271
+ this.visitArguments(node.typeArguments, node.args);
272
+ }
273
+ visitArguments(typeArguments: TypeNode[] | null, args: Expression[]) {
274
+ this.visit(typeArguments);
275
+ this.visit(args);
276
+ }
277
+ visitClassExpression(node: ClassExpression) {
278
+ this.visit(node.declaration);
279
+ }
280
+ visitCommaExpression(node: CommaExpression) {
281
+ this.visit(node.expressions);
282
+ }
283
+ visitElementAccessExpression(node: ElementAccessExpression) {
284
+ this.visit(node.elementExpression);
285
+ this.visit(node.expression);
286
+ }
287
+ visitFunctionExpression(node: FunctionExpression) {
288
+ this.visit(node.declaration);
289
+ }
290
+ visitLiteralExpression(node: LiteralExpression) {
291
+ if (node instanceof FloatLiteralExpression) {
292
+ this.visitFloatLiteralExpression(node);
293
+ } else if (node instanceof IntegerLiteralExpression) {
294
+ this.visitIntegerLiteralExpression(node);
295
+ } else if (node instanceof StringLiteralExpression) {
296
+ this.visitStringLiteralExpression(node);
297
+ } else if (node instanceof TemplateLiteralExpression) {
298
+ this.visitTemplateLiteralExpression(node);
299
+ } else if (node instanceof RegexpLiteralExpression) {
300
+ this.visitRegexpLiteralExpression(node);
301
+ } else if (node instanceof ArrayLiteralExpression) {
302
+ this.visitArrayLiteralExpression(node);
303
+ } else if (node instanceof ObjectLiteralExpression) {
304
+ this.visitObjectLiteralExpression(node);
305
+ } else {
306
+ throw new Error(
307
+ "Invalid LiteralKind at visitLiteralExpression(): " + node.literalKind,
308
+ );
309
+ }
310
+ }
311
+ visitFloatLiteralExpression(node: FloatLiteralExpression) { }
312
+ visitInstanceOfExpression(node: InstanceOfExpression) {
313
+ this.visit(node.expression);
314
+ this.visit(node.isType);
315
+ }
316
+ visitIntegerLiteralExpression(node: IntegerLiteralExpression) { }
317
+ visitStringLiteral(str: string, singleQuoted: boolean = false) { }
318
+ visitStringLiteralExpression(node: StringLiteralExpression) {
319
+ this.visitStringLiteral(node.value);
320
+ }
321
+ visitTemplateLiteralExpression(node: TemplateLiteralExpression) { }
322
+ visitRegexpLiteralExpression(node: RegexpLiteralExpression) { }
323
+ visitNewExpression(node: NewExpression) {
324
+ this.visit(node.typeArguments);
325
+ this.visitArguments(node.typeArguments, node.args);
326
+ this.visit(node.args);
327
+ }
328
+ visitParenthesizedExpression(node: ParenthesizedExpression) {
329
+ this.visit(node.expression);
330
+ }
331
+ visitPropertyAccessExpression(node: PropertyAccessExpression) {
332
+ this.visit(node.property);
333
+ this.visit(node.expression);
334
+ }
335
+ visitTernaryExpression(node: TernaryExpression) {
336
+ this.visit(node.condition);
337
+ this.visit(node.ifThen);
338
+ this.visit(node.ifElse);
339
+ }
340
+ visitUnaryExpression(node: UnaryExpression) {
341
+ this.visit(node.operand);
342
+ }
343
+ visitUnaryPostfixExpression(node: UnaryPostfixExpression) {
344
+ this.visit(node.operand);
345
+ }
346
+ visitUnaryPrefixExpression(node: UnaryPrefixExpression) {
347
+ this.visit(node.operand);
348
+ }
349
+ visitSuperExpression(node: SuperExpression) { }
350
+ visitFalseExpression(node: FalseExpression) { }
351
+ visitTrueExpression(node: TrueExpression) { }
352
+ visitThisExpression(node: ThisExpression) { }
353
+ visitNullExperssion(node: NullExpression) { }
354
+ visitConstructorExpression(node: ConstructorExpression) { }
355
+ visitNodeAndTerminate(statement: Statement) { }
356
+ visitBlockStatement(node: BlockStatement) {
357
+ this.depth++;
358
+ this.visit(node.statements);
359
+ this.depth--;
360
+ }
361
+ visitBreakStatement(node: BreakStatement) {
362
+ this.visit(node.label);
363
+ }
364
+ visitContinueStatement(node: ContinueStatement) {
365
+ this.visit(node.label);
366
+ }
367
+ visitClassDeclaration(node: ClassDeclaration, isDefault: boolean = false) {
368
+ this.visit(node.name);
369
+ this.depth++;
370
+ this.visit(node.decorators);
371
+ if (
372
+ node.isGeneric ? node.typeParameters != null : node.typeParameters == null
373
+ ) {
374
+ this.visit(node.typeParameters);
375
+ this.visit(node.extendsType);
376
+ this.visit(node.implementsTypes);
377
+ this.visit(node.members);
378
+ this.depth--;
379
+ } else {
380
+ throw new Error(
381
+ "Expected to type parameters to match class declaration, but found type mismatch instead!",
382
+ );
383
+ }
384
+ }
385
+ visitDoStatement(node: DoStatement) {
386
+ this.visit(node.condition);
387
+ this.visit(node.body);
388
+ }
389
+ visitEmptyStatement(node: EmptyStatement) { }
390
+ visitEnumDeclaration(node: EnumDeclaration, isDefault: boolean = false) {
391
+ this.visit(node.name);
392
+ this.visit(node.decorators);
393
+ this.visit(node.values);
394
+ }
395
+ visitEnumValueDeclaration(node: EnumValueDeclaration) {
396
+ this.visit(node.name);
397
+ this.visit(node.initializer);
398
+ }
399
+ visitExportImportStatement(node: ExportImportStatement) {
400
+ this.visit(node.name);
401
+ this.visit(node.externalName);
402
+ }
403
+ visitExportMember(node: ExportMember) {
404
+ this.visit(node.localName);
405
+ this.visit(node.exportedName);
406
+ }
407
+ visitExportStatement(node: ExportStatement) {
408
+ this.visit(node.path);
409
+ this.visit(node.members);
410
+ }
411
+ visitExportDefaultStatement(node: ExportDefaultStatement) {
412
+ this.visit(node.declaration);
413
+ }
414
+ visitExpressionStatement(node: ExpressionStatement) {
415
+ this.visit(node.expression);
416
+ }
417
+ visitFieldDeclaration(node: FieldDeclaration) {
418
+ this.visit(node.name);
419
+ this.visit(node.type);
420
+ this.visit(node.initializer);
421
+ this.visit(node.decorators);
422
+ }
423
+ visitForStatement(node: ForStatement) {
424
+ this.visit(node.initializer);
425
+ this.visit(node.condition);
426
+ this.visit(node.incrementor);
427
+ this.visit(node.body);
428
+ }
429
+ visitFunctionDeclaration(
430
+ node: FunctionDeclaration,
431
+ isDefault: boolean = false,
432
+ ) {
433
+ this.visit(node.name);
434
+ this.visit(node.decorators);
435
+ this.visit(node.typeParameters);
436
+ this.visit(node.signature);
437
+ this.depth++;
438
+ this.visit(node.body);
439
+ this.depth--;
440
+ }
441
+ visitIfStatement(node: IfStatement) {
442
+ this.visit(node.condition);
443
+ this.visit(node.ifTrue);
444
+ this.visit(node.ifFalse);
445
+ }
446
+ visitImportDeclaration(node: ImportDeclaration) {
447
+ this.visit(node.foreignName);
448
+ this.visit(node.name);
449
+ this.visit(node.decorators);
450
+ }
451
+ visitImportStatement(node: ImportStatement) {
452
+ this.visit(node.namespaceName);
453
+ this.visit(node.declarations);
454
+ }
455
+ visitIndexSignature(node: IndexSignatureNode) {
456
+ this.visit(node.keyType);
457
+ this.visit(node.valueType);
458
+ }
459
+ visitInterfaceDeclaration(
460
+ node: InterfaceDeclaration,
461
+ isDefault: boolean = false,
462
+ ) {
463
+ this.visit(node.name);
464
+ this.visit(node.typeParameters);
465
+ this.visit(node.implementsTypes);
466
+ this.visit(node.extendsType);
467
+ this.depth++;
468
+ this.visit(node.members);
469
+ this.depth--;
470
+ }
471
+ visitMethodDeclaration(node: MethodDeclaration) {
472
+ this.visit(node.name);
473
+ this.visit(node.typeParameters);
474
+ this.visit(node.signature);
475
+ this.visit(node.decorators);
476
+ this.depth++;
477
+ this.visit(node.body);
478
+ this.depth--;
479
+ }
480
+ visitNamespaceDeclaration(
481
+ node: NamespaceDeclaration,
482
+ isDefault: boolean = false,
483
+ ) {
484
+ this.visit(node.name);
485
+ this.visit(node.decorators);
486
+ this.visit(node.members);
487
+ }
488
+ visitReturnStatement(node: ReturnStatement) {
489
+ this.visit(node.value);
490
+ }
491
+ visitSwitchCase(node: SwitchCase) {
492
+ this.visit(node.label);
493
+ this.visit(node.statements);
494
+ }
495
+ visitSwitchStatement(node: SwitchStatement) {
496
+ this.visit(node.condition);
497
+ this.depth++;
498
+ this.visit(node.cases);
499
+ this.depth--;
500
+ }
501
+ visitThrowStatement(node: ThrowStatement) {
502
+ this.visit(node.value);
503
+ }
504
+ visitTryStatement(node: TryStatement) {
505
+ this.visit(node.bodyStatements);
506
+ this.visit(node.catchVariable);
507
+ this.visit(node.catchStatements);
508
+ this.visit(node.finallyStatements);
509
+ }
510
+ visitTypeDeclaration(node: TypeDeclaration) {
511
+ this.visit(node.name);
512
+ this.visit(node.decorators);
513
+ this.visit(node.type);
514
+ this.visit(node.typeParameters);
515
+ }
516
+ visitVariableDeclaration(node: VariableDeclaration) {
517
+ this.visit(node.name);
518
+ this.visit(node.type);
519
+ this.visit(node.initializer);
520
+ }
521
+ visitVariableStatement(node: VariableStatement) {
522
+ this.visit(node.decorators);
523
+ this.visit(node.declarations);
524
+ }
525
+ visitWhileStatement(node: WhileStatement) {
526
+ this.visit(node.condition);
527
+ this.depth++;
528
+ this.visit(node.body);
529
+ this.depth--;
530
+ }
531
+ visitVoidStatement(node: VoidStatement) { }
532
+ visitComment(node: Comment) { }
533
+ visitDecoratorNode(node: DecoratorNode) {
534
+ this.visit(node.name);
535
+ this.visit(node.args);
536
+ }
537
+ visitParameter(node: ParameterNode) {
538
+ this.visit(node.name);
539
+ this.visit(node.implicitFieldDeclaration);
540
+ this.visit(node.initializer);
541
+ this.visit(node.type);
542
+ }
543
+ }
@@ -1,70 +1,30 @@
1
1
  {
2
2
  "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig.json to read more about this file */
3
+ "target": "ES2020",
4
+ "module": "ES2015",
5
+ "downlevelIteration": true,
6
+ "outDir": "./lib/",
7
+
8
+ "strict": true,
9
+ "noImplicitAny": true,
10
+ "strictNullChecks": true,
11
+ "strictFunctionTypes": true,
12
+ "strictBindCallApply": true ,
13
+ "strictPropertyInitialization": true,
14
+ "noImplicitThis": true,
15
+ "alwaysStrict": true,
4
16
 
5
- /* Basic Options */
6
- // "incremental": true, /* Enable incremental compilation */
7
- "target": "es2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
8
- "module": "es2020" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
9
- // "lib": [], /* Specify library files to be included in the compilation. */
10
- // "allowJs": true, /* Allow javascript files to be compiled. */
11
- // "checkJs": true, /* Report errors in .js files. */
12
- // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
13
- "declaration": false /* Generates corresponding '.d.ts' file. */,
14
- // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15
- "sourceMap": false /* Generates corresponding '.map' file. */,
16
- // "outFile": "./", /* Concatenate and emit output to single file. */
17
- "outDir": "./lib" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
18
- // "composite": true, /* Enable project compilation */
19
- // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
20
- // "removeComments": true, /* Do not emit comments to output. */
21
- // "noEmit": true, /* Do not emit outputs. */
22
- // "importHelpers": true, /* Import emit helpers from 'tslib'. */
23
- "downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */,
24
- // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
17
+ "noUnusedLocals": true,
18
+ "noUnusedParameters": false,
19
+ "noImplicitReturns": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+ "noPropertyAccessFromIndexSignature": true,
25
23
 
26
- /* Strict Type-Checking Options */
27
- "strict": true /* Enable all strict type-checking options. */,
28
- "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'Unknown' type. */,
29
- "strictNullChecks": true /* Enable strict null checks. */,
30
- "strictFunctionTypes": true /* Enable strict checking of function types. */,
31
- "strictBindCallApply": true /* Enable strict 'bind', 'call', and 'apply' methods on functions. */,
32
- "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */,
33
- "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'Unknown' type. */,
34
- "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */,
24
+ "moduleResolution": "node",
25
+ "esModuleInterop": false,
35
26
 
36
- /* Additional Checks */
37
- "noUnusedLocals": true /* Report errors on unused locals. */,
38
- "noUnusedParameters": true /* Report errors on unused parameters. */,
39
- "noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
40
- // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
41
- "noUncheckedIndexedAccess": true /* Include 'undefined' in index signature results */,
42
- "noPropertyAccessFromIndexSignature": true /* Require undeclared properties from index signatures to use element accesses. */,
43
-
44
- /* Module Resolution Options */
45
- "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
46
- // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
47
- // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
48
- // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
49
- // "typeRoots": [], /* List of folders to include type definitions from. */
50
- // "types": [], /* Type declaration files to be included in compilation. */
51
- // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
52
- "esModuleInterop": false /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
53
- // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
54
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
55
-
56
- /* Source Map Options */
57
- // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
58
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
59
- // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
60
- // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
61
-
62
- /* Experimental Options */
63
- // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
64
- // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
65
-
66
- /* Advanced Options */
67
- "skipLibCheck": true /* Skip type checking of declaration files. */,
68
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
27
+ "skipLibCheck": false,
28
+ "forceConsistentCasingInFileNames": true
69
29
  }
70
30
  }