tsc-ts 0.0.9 → 0.1.0
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.
- package/README.md +2 -2
- package/bin/tsc-ts.js +70 -1
- package/dist/api/compiler/ast-utilities.d.ts +19 -1
- package/dist/api/compiler/ast-utilities.js +180 -95
- package/dist/api/compiler/ast.d.ts +22 -15
- package/dist/api/compiler/ast.js +1026 -995
- package/dist/api/compiler/astnav.js +15 -15
- package/dist/api/compiler/binder-utilities.js +186 -186
- package/dist/api/compiler/binder.js +290 -263
- package/dist/api/compiler/character-codes.js +2 -2
- package/dist/api/compiler/checker-calls.js +178 -124
- package/dist/api/compiler/checker-classes.d.ts +14 -3
- package/dist/api/compiler/checker-classes.js +134 -90
- package/dist/api/compiler/checker-contextual.js +64 -61
- package/dist/api/compiler/checker-declaration-order.js +79 -79
- package/dist/api/compiler/checker-declarations.d.ts +1 -0
- package/dist/api/compiler/checker-declarations.js +160 -136
- package/dist/api/compiler/checker-declared-types.js +67 -65
- package/dist/api/compiler/checker-decorators.js +77 -77
- package/dist/api/compiler/checker-deprecation.d.ts +8 -3
- package/dist/api/compiler/checker-deprecation.js +76 -55
- package/dist/api/compiler/checker-destructuring.js +47 -45
- package/dist/api/compiler/checker-elaboration.js +24 -24
- package/dist/api/compiler/checker-emit-helpers.js +4 -4
- package/dist/api/compiler/checker-emit-resolver.d.ts +4 -2
- package/dist/api/compiler/checker-emit-resolver.js +25 -13
- package/dist/api/compiler/checker-evaluator.js +9 -9
- package/dist/api/compiler/checker-expressions.js +244 -211
- package/dist/api/compiler/checker-functions.js +113 -107
- package/dist/api/compiler/checker-generated-code.d.ts +0 -11
- package/dist/api/compiler/checker-generated-code.js +28 -52
- package/dist/api/compiler/checker-grammar.d.ts +1 -0
- package/dist/api/compiler/checker-grammar.js +472 -440
- package/dist/api/compiler/checker-heritage.js +91 -93
- package/dist/api/compiler/checker-inference.d.ts +77 -5
- package/dist/api/compiler/checker-inference.js +487 -107
- package/dist/api/compiler/checker-iteration.d.ts +0 -10
- package/dist/api/compiler/checker-iteration.js +35 -52
- package/dist/api/compiler/checker-javascript.js +14 -14
- package/dist/api/compiler/checker-jsdoc.d.ts +8 -10
- package/dist/api/compiler/checker-jsdoc.js +67 -58
- package/dist/api/compiler/checker-jsx.js +105 -88
- package/dist/api/compiler/checker-members.d.ts +9 -2
- package/dist/api/compiler/checker-members.js +212 -75
- package/dist/api/compiler/checker-modules.d.ts +15 -6
- package/dist/api/compiler/checker-modules.js +469 -309
- package/dist/api/compiler/checker-narrowing.js +273 -189
- package/dist/api/compiler/checker-object-literals.js +25 -22
- package/dist/api/compiler/checker-operators.js +126 -118
- package/dist/api/compiler/checker-overloads.js +27 -27
- package/dist/api/compiler/checker-property-access.js +59 -55
- package/dist/api/compiler/checker-services.d.ts +1 -0
- package/dist/api/compiler/checker-services.js +222 -210
- package/dist/api/compiler/checker-signatures.js +65 -49
- package/dist/api/compiler/checker-source-file.d.ts +5 -0
- package/dist/api/compiler/checker-source-file.js +154 -130
- package/dist/api/compiler/checker-statements.js +33 -32
- package/dist/api/compiler/checker-super.js +50 -50
- package/dist/api/compiler/checker-symbol-types.js +109 -93
- package/dist/api/compiler/checker-symbols.d.ts +13 -1
- package/dist/api/compiler/checker-symbols.js +264 -149
- package/dist/api/compiler/checker-type-factory.d.ts +5 -0
- package/dist/api/compiler/checker-type-factory.js +145 -36
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -0
- package/dist/api/compiler/checker-type-nodes.js +179 -141
- package/dist/api/compiler/checker-type-operators.d.ts +2 -0
- package/dist/api/compiler/checker-type-operators.js +110 -63
- package/dist/api/compiler/checker-types.d.ts +80 -3
- package/dist/api/compiler/checker-types.js +121 -2
- package/dist/api/compiler/checker-unused.js +114 -118
- package/dist/api/compiler/checker-utilities.js +11 -11
- package/dist/api/compiler/checker.d.ts +104 -31
- package/dist/api/compiler/checker.js +181 -33
- package/dist/api/compiler/command-line.d.ts +1 -3
- package/dist/api/compiler/command-line.js +47 -44
- package/dist/api/compiler/compile-program.d.ts +42 -3
- package/dist/api/compiler/compile-program.js +139 -27
- package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
- package/dist/api/compiler/diagnostic-messages.js +128 -122
- package/dist/api/compiler/diagnostics.d.ts +22 -0
- package/dist/api/compiler/diagnostics.js +93 -11
- package/dist/api/compiler/emitter.d.ts +7 -1
- package/dist/api/compiler/emitter.js +53 -11
- package/dist/api/compiler/file-include.d.ts +2 -1
- package/dist/api/compiler/file-include.js +11 -7
- package/dist/api/compiler/file-loader.d.ts +21 -1
- package/dist/api/compiler/file-loader.js +201 -48
- package/dist/api/compiler/instantiation.d.ts +7 -0
- package/dist/api/compiler/instantiation.js +101 -49
- package/dist/api/compiler/jsdoc.js +23 -23
- package/dist/api/compiler/link-tables.d.ts +48 -18
- package/dist/api/compiler/link-tables.js +80 -37
- package/dist/api/compiler/locales/cs-CZ.d.ts +1 -1
- package/dist/api/compiler/locales/cs-CZ.js +1 -1
- package/dist/api/compiler/locales/de-DE.d.ts +1 -1
- package/dist/api/compiler/locales/de-DE.js +1 -1
- package/dist/api/compiler/locales/es-ES.d.ts +1 -1
- package/dist/api/compiler/locales/es-ES.js +1 -1
- package/dist/api/compiler/locales/fr-FR.d.ts +1 -1
- package/dist/api/compiler/locales/fr-FR.js +1 -1
- package/dist/api/compiler/locales/it-IT.d.ts +1 -1
- package/dist/api/compiler/locales/it-IT.js +1 -1
- package/dist/api/compiler/locales/ja-JP.d.ts +1 -1
- package/dist/api/compiler/locales/ja-JP.js +1 -1
- package/dist/api/compiler/locales/ko-KR.d.ts +1 -1
- package/dist/api/compiler/locales/ko-KR.js +1 -1
- package/dist/api/compiler/locales/pl-PL.d.ts +1 -1
- package/dist/api/compiler/locales/pl-PL.js +1 -1
- package/dist/api/compiler/locales/pt-BR.d.ts +1 -1
- package/dist/api/compiler/locales/pt-BR.js +1 -1
- package/dist/api/compiler/locales/ru-RU.d.ts +1 -1
- package/dist/api/compiler/locales/ru-RU.js +1 -1
- package/dist/api/compiler/locales/tr-TR.d.ts +1 -1
- package/dist/api/compiler/locales/tr-TR.js +1 -1
- package/dist/api/compiler/locales/zh-CN.d.ts +1 -1
- package/dist/api/compiler/locales/zh-CN.js +1 -1
- package/dist/api/compiler/locales/zh-TW.d.ts +1 -1
- package/dist/api/compiler/locales/zh-TW.js +1 -1
- package/dist/api/compiler/module-resolution-types.js +6 -6
- package/dist/api/compiler/module-resolution.d.ts +10 -1
- package/dist/api/compiler/module-resolution.js +115 -84
- package/dist/api/compiler/module-specifiers.d.ts +15 -0
- package/dist/api/compiler/module-specifiers.js +24 -18
- package/dist/api/compiler/name-resolver.js +74 -65
- package/dist/api/compiler/node-builder-names.d.ts +11 -3
- package/dist/api/compiler/node-builder-names.js +210 -90
- package/dist/api/compiler/node-builder-pseudo.js +29 -31
- package/dist/api/compiler/node-builder-reuse.js +23 -22
- package/dist/api/compiler/node-builder.d.ts +18 -1
- package/dist/api/compiler/node-builder.js +191 -102
- package/dist/api/compiler/option-declarations.d.ts +2 -6
- package/dist/api/compiler/option-declarations.js +315 -375
- package/dist/api/compiler/options.d.ts +15 -33
- package/dist/api/compiler/options.js +21 -54
- package/dist/api/compiler/output-paths.d.ts +4 -1
- package/dist/api/compiler/output-paths.js +6 -11
- package/dist/api/compiler/package-json.d.ts +3 -3
- package/dist/api/compiler/package-json.js +11 -10
- package/dist/api/compiler/parallel-parse.d.ts +3 -2
- package/dist/api/compiler/parallel-parse.js +17 -5
- package/dist/api/compiler/parser.d.ts +40 -19
- package/dist/api/compiler/parser.js +308 -216
- package/dist/api/compiler/path.d.ts +9 -0
- package/dist/api/compiler/path.js +20 -3
- package/dist/api/compiler/printer/emit-context.d.ts +5 -1
- package/dist/api/compiler/printer/emit-context.js +20 -1
- package/dist/api/compiler/printer/factory-base.d.ts +2 -2
- package/dist/api/compiler/printer/factory-base.js +7 -3
- package/dist/api/compiler/printer/factory.js +3 -1
- package/dist/api/compiler/printer/helpers.js +10 -1
- package/dist/api/compiler/printer/name-generator.d.ts +1 -1
- package/dist/api/compiler/printer/name-generator.js +35 -16
- package/dist/api/compiler/printer/printer.d.ts +49 -2
- package/dist/api/compiler/printer/printer.js +539 -293
- package/dist/api/compiler/printer/utilities.js +149 -147
- package/dist/api/compiler/program-checker.d.ts +12 -2
- package/dist/api/compiler/program-checker.js +88 -34
- package/dist/api/compiler/program-utilities.d.ts +3 -1
- package/dist/api/compiler/program-utilities.js +28 -15
- package/dist/api/compiler/program.d.ts +4 -6
- package/dist/api/compiler/program.js +74 -87
- package/dist/api/compiler/pseudo-bigint.d.ts +2 -0
- package/dist/api/compiler/pseudo-bigint.js +18 -0
- package/dist/api/compiler/regexp-checker.d.ts +1 -1
- package/dist/api/compiler/regexp-checker.js +93 -76
- package/dist/api/compiler/relations.d.ts +27 -4
- package/dist/api/compiler/relations.js +347 -180
- package/dist/api/compiler/reparser.js +60 -56
- package/dist/api/compiler/scanner.d.ts +19 -2
- package/dist/api/compiler/scanner.js +123 -108
- package/dist/api/compiler/shared-results.d.ts +463 -0
- package/dist/api/compiler/shared-results.js +2128 -0
- package/dist/api/compiler/sourcemap.js +2 -2
- package/dist/api/compiler/symbol-accessibility.js +87 -74
- package/dist/api/compiler/symbol.d.ts +23 -14
- package/dist/api/compiler/symbol.js +23 -11
- package/dist/api/compiler/syntax-kind.d.ts +198 -197
- package/dist/api/compiler/transformers/alias-references.js +247 -139
- package/dist/api/compiler/transformers/async-utilities.js +25 -25
- package/dist/api/compiler/transformers/async.d.ts +0 -1
- package/dist/api/compiler/transformers/async.js +64 -77
- package/dist/api/compiler/transformers/class-fields.d.ts +1 -0
- package/dist/api/compiler/transformers/class-fields.js +81 -78
- package/dist/api/compiler/transformers/commonjs-module.js +18 -15
- package/dist/api/compiler/transformers/const-enum-inliner.js +1 -1
- package/dist/api/compiler/transformers/declarations-diagnostics.js +247 -244
- package/dist/api/compiler/transformers/declarations-pseudo.js +100 -100
- package/dist/api/compiler/transformers/declarations-resolver.d.ts +0 -3
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -2
- package/dist/api/compiler/transformers/declarations-syntactic.js +134 -156
- package/dist/api/compiler/transformers/declarations-tracker.js +18 -18
- package/dist/api/compiler/transformers/declarations.d.ts +4 -1
- package/dist/api/compiler/transformers/declarations.js +305 -238
- package/dist/api/compiler/transformers/decorator-metadata.d.ts +1 -1
- package/dist/api/compiler/transformers/decorator-metadata.js +53 -45
- package/dist/api/compiler/transformers/decorator-utilities.js +24 -24
- package/dist/api/compiler/transformers/destructuring.js +19 -18
- package/dist/api/compiler/transformers/emit-resolver.js +1 -1
- package/dist/api/compiler/transformers/es-decorators.js +55 -55
- package/dist/api/compiler/transformers/external-module-info.js +3 -3
- package/dist/api/compiler/transformers/for-await.js +25 -25
- package/dist/api/compiler/transformers/import-elision.js +14 -14
- package/dist/api/compiler/transformers/jsx.js +12 -12
- package/dist/api/compiler/transformers/legacy-decorators.js +17 -17
- package/dist/api/compiler/transformers/module.js +8 -8
- package/dist/api/compiler/transformers/named-evaluation.js +4 -4
- package/dist/api/compiler/transformers/object-rest-spread.js +20 -20
- package/dist/api/compiler/transformers/optional-chain.js +10 -10
- package/dist/api/compiler/transformers/reference-resolver.d.ts +12 -1
- package/dist/api/compiler/transformers/reference-resolver.js +131 -69
- package/dist/api/compiler/transformers/runtime-syntax.js +35 -31
- package/dist/api/compiler/transformers/subtree-facts.js +47 -47
- package/dist/api/compiler/transformers/syntax-facts.js +56 -58
- package/dist/api/compiler/transformers/type-eraser.js +73 -66
- package/dist/api/compiler/transformers/type-serialization.js +24 -24
- package/dist/api/compiler/transformers/using.js +12 -12
- package/dist/api/compiler/transformers/utilities.js +77 -77
- package/dist/api/compiler/transformers/visitor-base.js +172 -172
- package/dist/api/compiler/transformers/visitor-hooks.js +6 -2
- package/dist/api/compiler/tsconfig.d.ts +10 -2
- package/dist/api/compiler/tsconfig.js +136 -48
- package/dist/api/compiler/type-printer.js +40 -3
- package/dist/api/compiler/types.d.ts +2 -1
- package/dist/api/library/ast.generated.d.ts +42 -39
- package/dist/api/library/ast.generated.js +1 -1
- package/dist/api/library/compiler-options.generated.d.ts +111 -100
- package/dist/api/library/compiler-options.generated.js +1 -1
- package/dist/api/library/disk.js +12 -1
- package/dist/api/library/enums.generated.d.ts +206 -206
- package/dist/api/library/enums.generated.js +206 -206
- package/dist/api/library/nodes.js +26 -26
- package/package.json +9 -9
- package/src/compiler/ast-utilities.ts +99 -7
- package/src/compiler/ast.ts +58 -26
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +79 -9
- package/src/compiler/checker-classes.ts +78 -24
- package/src/compiler/checker-contextual.ts +6 -1
- package/src/compiler/checker-declarations.ts +31 -4
- package/src/compiler/checker-declared-types.ts +8 -5
- package/src/compiler/checker-decorators.ts +1 -1
- package/src/compiler/checker-deprecation.ts +29 -8
- package/src/compiler/checker-destructuring.ts +10 -3
- package/src/compiler/checker-emit-helpers.ts +1 -0
- package/src/compiler/checker-emit-resolver.ts +16 -6
- package/src/compiler/checker-expressions.ts +79 -46
- package/src/compiler/checker-functions.ts +21 -6
- package/src/compiler/checker-generated-code.ts +2 -22
- package/src/compiler/checker-grammar.ts +136 -62
- package/src/compiler/checker-heritage.ts +22 -21
- package/src/compiler/checker-inference.ts +514 -82
- package/src/compiler/checker-iteration.ts +18 -31
- package/src/compiler/checker-javascript.ts +1 -1
- package/src/compiler/checker-jsdoc.ts +50 -27
- package/src/compiler/checker-jsx.ts +26 -4
- package/src/compiler/checker-members.ts +200 -56
- package/src/compiler/checker-modules.ts +332 -65
- package/src/compiler/checker-narrowing.ts +98 -19
- package/src/compiler/checker-object-literals.ts +3 -0
- package/src/compiler/checker-operators.ts +11 -4
- package/src/compiler/checker-property-access.ts +7 -2
- package/src/compiler/checker-services.ts +39 -12
- package/src/compiler/checker-signatures.ts +15 -1
- package/src/compiler/checker-source-file.ts +39 -13
- package/src/compiler/checker-statements.ts +3 -2
- package/src/compiler/checker-symbol-types.ts +29 -6
- package/src/compiler/checker-symbols.ts +158 -15
- package/src/compiler/checker-type-factory.ts +124 -23
- package/src/compiler/checker-type-nodes.ts +46 -3
- package/src/compiler/checker-type-operators.ts +83 -26
- package/src/compiler/checker-types.ts +147 -4
- package/src/compiler/checker-unused.ts +9 -14
- package/src/compiler/checker.ts +203 -39
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +167 -27
- package/src/compiler/decoder.ts +13 -4
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- package/src/compiler/diagnostics.ts +84 -3
- package/src/compiler/emitter.ts +57 -8
- package/src/compiler/encoder.ts +23 -8
- package/src/compiler/file-include.ts +9 -3
- package/src/compiler/file-loader.ts +197 -38
- package/src/compiler/help.ts +10 -14
- package/src/compiler/incremental.ts +165 -30
- package/src/compiler/init.ts +2 -7
- package/src/compiler/instantiation.ts +77 -22
- package/src/compiler/jsdoc.ts +3 -1
- package/src/compiler/link-tables.ts +82 -37
- package/src/compiler/locales/cs-CZ.ts +1 -1
- package/src/compiler/locales/de-DE.ts +1 -1
- package/src/compiler/locales/es-ES.ts +1 -1
- package/src/compiler/locales/fr-FR.ts +1 -1
- package/src/compiler/locales/it-IT.ts +1 -1
- package/src/compiler/locales/ja-JP.ts +1 -1
- package/src/compiler/locales/ko-KR.ts +1 -1
- package/src/compiler/locales/pl-PL.ts +1 -1
- package/src/compiler/locales/pt-BR.ts +1 -1
- package/src/compiler/locales/ru-RU.ts +1 -1
- package/src/compiler/locales/tr-TR.ts +1 -1
- package/src/compiler/locales/zh-CN.ts +1 -1
- package/src/compiler/locales/zh-TW.ts +1 -1
- package/src/compiler/module-resolution.ts +44 -8
- package/src/compiler/module-specifiers.ts +62 -20
- package/src/compiler/name-resolver.ts +9 -1
- package/src/compiler/node-builder-names.ts +236 -54
- package/src/compiler/node-builder-pseudo.ts +4 -7
- package/src/compiler/node-builder-reuse.ts +5 -4
- package/src/compiler/node-builder.ts +130 -31
- package/src/compiler/option-declarations.ts +33 -103
- package/src/compiler/options.ts +23 -62
- package/src/compiler/output-paths.ts +5 -18
- package/src/compiler/package-entrypoints.ts +345 -0
- package/src/compiler/package-json.ts +4 -4
- package/src/compiler/parallel-check.ts +326 -52
- package/src/compiler/parallel-emit.ts +320 -0
- package/src/compiler/parallel-parse.ts +16 -5
- package/src/compiler/parse-thread.ts +3 -0
- package/src/compiler/parser.ts +156 -39
- package/src/compiler/path.ts +22 -2
- package/src/compiler/printer/emit-context.ts +21 -0
- package/src/compiler/printer/factory-base.ts +10 -3
- package/src/compiler/printer/factory.ts +4 -1
- package/src/compiler/printer/helpers.ts +10 -1
- package/src/compiler/printer/name-generator.ts +24 -2
- package/src/compiler/printer/printer.ts +266 -30
- package/src/compiler/printer/utilities.ts +8 -2
- package/src/compiler/program-checker.ts +57 -5
- package/src/compiler/program-utilities.ts +23 -10
- package/src/compiler/program.ts +18 -26
- package/src/compiler/pseudo-bigint.ts +17 -0
- package/src/compiler/regexp-checker.ts +63 -30
- package/src/compiler/relations.ts +240 -77
- package/src/compiler/reparser.ts +7 -2
- package/src/compiler/scanner.ts +109 -79
- package/src/compiler/shared-results.ts +2414 -0
- package/src/compiler/show-config.ts +18 -1
- package/src/compiler/sourcemap.ts +2 -2
- package/src/compiler/symbol-accessibility.ts +26 -3
- package/src/compiler/symbol.ts +46 -24
- package/src/compiler/syntax-kind.ts +188 -187
- package/src/compiler/thread-entry.ts +64 -4
- package/src/compiler/transformers/alias-references.ts +123 -4
- package/src/compiler/transformers/async.ts +2 -17
- package/src/compiler/transformers/class-fields.ts +13 -12
- package/src/compiler/transformers/commonjs-module.ts +11 -7
- package/src/compiler/transformers/declarations-diagnostics.ts +5 -3
- package/src/compiler/transformers/declarations-pseudo.ts +2 -4
- package/src/compiler/transformers/declarations-resolver.ts +0 -3
- package/src/compiler/transformers/declarations-syntactic.ts +1 -21
- package/src/compiler/transformers/declarations.ts +134 -48
- package/src/compiler/transformers/decorator-metadata.ts +9 -1
- package/src/compiler/transformers/destructuring.ts +4 -3
- package/src/compiler/transformers/external-module-info.ts +1 -1
- package/src/compiler/transformers/jsx.ts +2 -1
- package/src/compiler/transformers/reference-resolver.ts +83 -19
- package/src/compiler/transformers/runtime-syntax.ts +6 -1
- package/src/compiler/transformers/syntax-facts.ts +2 -7
- package/src/compiler/transformers/type-eraser.ts +10 -1
- package/src/compiler/transformers/type-serialization.ts +3 -2
- package/src/compiler/transformers/visitor-base.ts +2 -1
- package/src/compiler/transformers/visitor-hooks.ts +9 -4
- package/src/compiler/tsc-build.ts +66 -9
- package/src/compiler/tsc-cli.ts +7 -0
- package/src/compiler/tsc-compile.ts +284 -4
- package/src/compiler/tsc-watch.ts +74 -45
- package/src/compiler/tsconfig.ts +176 -19
- package/src/compiler/type-printer.ts +36 -2
- package/src/compiler/types.ts +2 -1
- package/src/library/ast.generated.ts +57 -41
- package/src/library/compiler-options.generated.ts +117 -103
- package/src/library/disk.ts +10 -1
- package/src/library/enums.generated.ts +196 -196
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsc-ts",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "The TypeScript 7 compiler, ported to TypeScript and compiled to a native executable.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scriptc/threads": "0.4.
|
|
32
|
+
"@scriptc/threads": "0.4.7"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=20"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@tsc-ts/darwin-arm64": "0.0
|
|
39
|
-
"@tsc-ts/darwin-x64": "0.0
|
|
40
|
-
"@tsc-ts/linux-arm64-gnu": "0.0
|
|
41
|
-
"@tsc-ts/linux-arm64-musl": "0.0
|
|
42
|
-
"@tsc-ts/linux-x64-gnu": "0.0
|
|
43
|
-
"@tsc-ts/linux-x64-musl": "0.0
|
|
44
|
-
"@tsc-ts/win32-x64-msvc": "0.0
|
|
38
|
+
"@tsc-ts/darwin-arm64": "0.1.0",
|
|
39
|
+
"@tsc-ts/darwin-x64": "0.1.0",
|
|
40
|
+
"@tsc-ts/linux-arm64-gnu": "0.1.0",
|
|
41
|
+
"@tsc-ts/linux-arm64-musl": "0.1.0",
|
|
42
|
+
"@tsc-ts/linux-x64-gnu": "0.1.0",
|
|
43
|
+
"@tsc-ts/linux-x64-musl": "0.1.0",
|
|
44
|
+
"@tsc-ts/win32-x64-msvc": "0.1.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ExternalModuleReference,
|
|
8
8
|
Identifier,
|
|
9
9
|
ImportClause,
|
|
10
|
+
ImportDeclaration,
|
|
10
11
|
ImportEqualsDeclaration,
|
|
11
12
|
ImportTypeNode,
|
|
12
13
|
JsxNamespacedName,
|
|
@@ -19,12 +20,15 @@ import {
|
|
|
19
20
|
PartiallyEmittedExpression,
|
|
20
21
|
PropertyAccessExpression,
|
|
21
22
|
StringLiteral,
|
|
23
|
+
TypeReferenceNode,
|
|
22
24
|
getExpression,
|
|
23
25
|
getIsTypeOnly,
|
|
24
26
|
getModuleSpecifier,
|
|
25
27
|
getText,
|
|
26
28
|
getType,
|
|
27
29
|
} from './ast.js';
|
|
30
|
+
import { isTypeNodeKind } from './binder-utilities.js';
|
|
31
|
+
import { CharacterCodes, isLineBreak, isWhiteSpaceLike } from './character-codes.js';
|
|
28
32
|
import { skipTrivia } from './scanner.js';
|
|
29
33
|
import { SyntaxKind } from './syntax-kind.js';
|
|
30
34
|
import { TokenFlags } from './types.js';
|
|
@@ -394,10 +398,45 @@ export function tagNamesAreEquivalent(lhs: Node, rhs: Node): boolean {
|
|
|
394
398
|
throw new Error('Unhandled case in tagNamesAreEquivalent');
|
|
395
399
|
}
|
|
396
400
|
|
|
401
|
+
/** Whether `node` is a JSDoc type expression or a type node in one. */
|
|
402
|
+
export function isJSDocTypeExpressionOrChild(node: Node): boolean {
|
|
403
|
+
if (node.kind === SyntaxKind.JSDocTypeExpression) return true;
|
|
404
|
+
if ((node.flags & (NodeFlags.JSDoc | NodeFlags.Reparsed)) === 0) return false;
|
|
405
|
+
for (let current: Node | undefined = node; current !== undefined; current = current.parent)
|
|
406
|
+
if (isTypeNodeKind(current.kind)) return true;
|
|
407
|
+
return false;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** The text of a JSDoc type with the leading whitespace and `*` of each line removed, and LF line breaks. */
|
|
411
|
+
export function normalizeJSDocTypeSourceText(text: string): string {
|
|
412
|
+
let result = '';
|
|
413
|
+
let lineStart = 0;
|
|
414
|
+
let multiline = false;
|
|
415
|
+
for (let i = 0; i < text.length; i++) {
|
|
416
|
+
const ch = text.charCodeAt(i);
|
|
417
|
+
if (!isLineBreak(ch)) continue;
|
|
418
|
+
result += stripLeadingJSDocComment(text.substring(lineStart, i)) + '\n';
|
|
419
|
+
multiline = true;
|
|
420
|
+
if (ch === CharacterCodes.carriageReturn && text.charCodeAt(i + 1) === CharacterCodes.lineFeed) i++;
|
|
421
|
+
lineStart = i + 1;
|
|
422
|
+
}
|
|
423
|
+
if (!multiline) return stripLeadingJSDocComment(text);
|
|
424
|
+
return result + stripLeadingJSDocComment(text.substring(lineStart));
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
function stripLeadingJSDocComment(line: string): string {
|
|
428
|
+
let start = 0;
|
|
429
|
+
while (start < line.length && isWhiteSpaceLike(line.charCodeAt(start))) start++;
|
|
430
|
+
if (start < line.length && line.charCodeAt(start) === CharacterCodes.asterisk) start++;
|
|
431
|
+
while (start < line.length && isWhiteSpaceLike(line.charCodeAt(start))) start++;
|
|
432
|
+
return start === 0 ? line : line.substring(start);
|
|
433
|
+
}
|
|
434
|
+
|
|
397
435
|
/** The source text of a node, without leading trivia. */
|
|
398
436
|
export function getTextOfNodeFromSourceText(sourceText: string, node: Node): string {
|
|
399
437
|
if (nodeIsMissing(node)) return '';
|
|
400
|
-
|
|
438
|
+
let text = sourceText.substring(skipTrivia(sourceText, node.pos), node.end);
|
|
439
|
+
if (isJSDocTypeExpressionOrChild(node)) text = normalizeJSDocTypeSourceText(text);
|
|
401
440
|
if ((node.flags & NodeFlags.ReparserTransformedLiteral) !== 0) {
|
|
402
441
|
if (node instanceof StringLiteral)
|
|
403
442
|
return ((node as StringLiteral).tokenFlags & TokenFlags.SingleQuote) !== 0 ? "'" + text + "'" : '"' + text + '"';
|
|
@@ -415,14 +454,46 @@ export function isImportMeta(node: Node): boolean {
|
|
|
415
454
|
);
|
|
416
455
|
}
|
|
417
456
|
|
|
418
|
-
/** `import(…)` or `import.
|
|
457
|
+
/** `import(…)`, `import.defer(…)` or `import.source(…)`. */
|
|
419
458
|
export function isImportCall(node: Node): boolean {
|
|
420
459
|
if (!(node instanceof CallExpression)) return false;
|
|
421
460
|
const e = (node as CallExpression).expression;
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
461
|
+
return e.kind === SyntaxKind.ImportKeyword || isImportPhaseMetaProperty(e);
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** `import.defer` or `import.source`. */
|
|
465
|
+
export function isImportPhaseMetaProperty(node: Node): boolean {
|
|
466
|
+
return isImportMetaPropertyNamed(node, 'defer') || isImportMetaPropertyNamed(node, 'source');
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export function isImportDeferMetaProperty(node: Node): boolean {
|
|
470
|
+
return isImportMetaPropertyNamed(node, 'defer');
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
export function isImportSourceMetaProperty(node: Node): boolean {
|
|
474
|
+
return isImportMetaPropertyNamed(node, 'source');
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
function isImportMetaPropertyNamed(node: Node, name: string): boolean {
|
|
478
|
+
return (
|
|
479
|
+
node instanceof MetaProperty &&
|
|
480
|
+
(node as MetaProperty).keywordToken === SyntaxKind.ImportKeyword &&
|
|
481
|
+
(node as MetaProperty).name.text === name
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** `import source x from "m"` or `import.source("m")`. */
|
|
486
|
+
export function isSourcePhaseImport(node: Node): boolean {
|
|
487
|
+
if (node instanceof ImportDeclaration) {
|
|
488
|
+
const clause = (node as ImportDeclaration).importClause;
|
|
489
|
+
return clause !== undefined && (clause as ImportClause).phaseModifier === SyntaxKind.SourceKeyword;
|
|
490
|
+
}
|
|
491
|
+
return isSourcePhaseImportCall(node);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/** `import.source(…)`. */
|
|
495
|
+
export function isSourcePhaseImportCall(node: Node): boolean {
|
|
496
|
+
return node instanceof CallExpression && isImportSourceMetaProperty((node as CallExpression).expression);
|
|
426
497
|
}
|
|
427
498
|
|
|
428
499
|
/** `require(x)` with one argument, a string literal if `requireStringLiteralLikeArgument`. */
|
|
@@ -512,7 +583,8 @@ export function isTypeDeclaration(node: Node): boolean {
|
|
|
512
583
|
case SyntaxKind.EnumDeclaration:
|
|
513
584
|
return true;
|
|
514
585
|
case SyntaxKind.ImportClause:
|
|
515
|
-
|
|
586
|
+
// `import type { a } from "m"` declares no type of its own.
|
|
587
|
+
return isTypeOnly(node) && (node as ImportClause).name !== undefined;
|
|
516
588
|
case SyntaxKind.ImportSpecifier:
|
|
517
589
|
case SyntaxKind.ExportSpecifier:
|
|
518
590
|
return isTypeOnly(node.parent!.parent!);
|
|
@@ -546,3 +618,23 @@ export function getEffectiveCheckNode(argument: Node): Node {
|
|
|
546
618
|
else return node;
|
|
547
619
|
}
|
|
548
620
|
}
|
|
621
|
+
|
|
622
|
+
/** The entity name of a heritage clause element: a type reference's type name, or an
|
|
623
|
+
* `ExpressionWithTypeArguments`'s expression. */
|
|
624
|
+
export function getHeritageClauseElementName(node: Node): Node {
|
|
625
|
+
if (node.kind === SyntaxKind.TypeReference) return (node as TypeReferenceNode).typeName;
|
|
626
|
+
return getExpression(node)!;
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
/** Whether a name, or the rightmost name of a qualified name, is the type name of a type reference in a
|
|
630
|
+
* heritage clause. */
|
|
631
|
+
export function isNameOfHeritageClauseTypeReference(nodeIn: Node): boolean {
|
|
632
|
+
let node = nodeIn;
|
|
633
|
+
while (node.parent!.kind === SyntaxKind.QualifiedName) node = node.parent!;
|
|
634
|
+
const parent = node.parent!;
|
|
635
|
+
return (
|
|
636
|
+
parent.kind === SyntaxKind.TypeReference &&
|
|
637
|
+
(parent as TypeReferenceNode).typeName === node &&
|
|
638
|
+
parent.parent?.kind === SyntaxKind.HeritageClause
|
|
639
|
+
);
|
|
640
|
+
}
|
package/src/compiler/ast.ts
CHANGED
|
@@ -527,11 +527,11 @@ export class PrivateIdentifier extends Node {
|
|
|
527
527
|
|
|
528
528
|
export class QualifiedName extends Node {
|
|
529
529
|
left: EntityName;
|
|
530
|
-
right:
|
|
530
|
+
right: MemberName;
|
|
531
531
|
// Set by the binder.
|
|
532
532
|
flowNode: FlowNode | undefined;
|
|
533
533
|
|
|
534
|
-
constructor(left: EntityName, right:
|
|
534
|
+
constructor(left: EntityName, right: MemberName) {
|
|
535
535
|
super(SyntaxKind.QualifiedName);
|
|
536
536
|
this.left = left;
|
|
537
537
|
this.right = right;
|
|
@@ -553,7 +553,7 @@ export class QualifiedName extends Node {
|
|
|
553
553
|
}
|
|
554
554
|
|
|
555
555
|
copy(): QualifiedName {
|
|
556
|
-
const node = new QualifiedName(this.left.deepClone(), this.right.
|
|
556
|
+
const node = new QualifiedName(this.left.deepClone(), this.right.deepClone());
|
|
557
557
|
node.flags = this.flags;
|
|
558
558
|
node.pos = this.pos;
|
|
559
559
|
node.end = this.end;
|
|
@@ -1696,8 +1696,8 @@ export class FunctionDeclaration extends Node {
|
|
|
1696
1696
|
fullSignature: TypeNode | undefined;
|
|
1697
1697
|
body: FunctionBody | undefined;
|
|
1698
1698
|
// Set by the binder.
|
|
1699
|
-
symbol: Symbol | undefined;
|
|
1700
1699
|
flowNode: FlowNode | undefined;
|
|
1700
|
+
symbol: Symbol | undefined;
|
|
1701
1701
|
localSymbol: Symbol | undefined;
|
|
1702
1702
|
locals: SymbolTable | undefined;
|
|
1703
1703
|
nextContainer: Node | undefined;
|
|
@@ -1723,8 +1723,8 @@ export class FunctionDeclaration extends Node {
|
|
|
1723
1723
|
this.type = type;
|
|
1724
1724
|
this.fullSignature = fullSignature;
|
|
1725
1725
|
this.body = body;
|
|
1726
|
-
this.symbol = undefined;
|
|
1727
1726
|
this.flowNode = undefined;
|
|
1727
|
+
this.symbol = undefined;
|
|
1728
1728
|
this.localSymbol = undefined;
|
|
1729
1729
|
this.locals = undefined;
|
|
1730
1730
|
this.nextContainer = undefined;
|
|
@@ -1783,8 +1783,8 @@ export class ClassDeclaration extends Node {
|
|
|
1783
1783
|
heritageClauses: NodeList | undefined;
|
|
1784
1784
|
members: NodeList;
|
|
1785
1785
|
// Set by the binder.
|
|
1786
|
-
symbol: Symbol | undefined;
|
|
1787
1786
|
flowNode: FlowNode | undefined;
|
|
1787
|
+
symbol: Symbol | undefined;
|
|
1788
1788
|
localSymbol: Symbol | undefined;
|
|
1789
1789
|
locals: SymbolTable | undefined;
|
|
1790
1790
|
nextContainer: Node | undefined;
|
|
@@ -1802,8 +1802,8 @@ export class ClassDeclaration extends Node {
|
|
|
1802
1802
|
this.typeParameters = typeParameters;
|
|
1803
1803
|
this.heritageClauses = heritageClauses;
|
|
1804
1804
|
this.members = members;
|
|
1805
|
-
this.symbol = undefined;
|
|
1806
1805
|
this.flowNode = undefined;
|
|
1806
|
+
this.symbol = undefined;
|
|
1807
1807
|
this.localSymbol = undefined;
|
|
1808
1808
|
this.locals = undefined;
|
|
1809
1809
|
this.nextContainer = undefined;
|
|
@@ -1948,8 +1948,8 @@ export class InterfaceDeclaration extends Node {
|
|
|
1948
1948
|
heritageClauses: NodeList | undefined;
|
|
1949
1949
|
members: NodeList;
|
|
1950
1950
|
// Set by the binder.
|
|
1951
|
-
symbol: Symbol | undefined;
|
|
1952
1951
|
flowNode: FlowNode | undefined;
|
|
1952
|
+
symbol: Symbol | undefined;
|
|
1953
1953
|
localSymbol: Symbol | undefined;
|
|
1954
1954
|
|
|
1955
1955
|
constructor(
|
|
@@ -1965,8 +1965,8 @@ export class InterfaceDeclaration extends Node {
|
|
|
1965
1965
|
this.typeParameters = typeParameters;
|
|
1966
1966
|
this.heritageClauses = heritageClauses;
|
|
1967
1967
|
this.members = members;
|
|
1968
|
-
this.symbol = undefined;
|
|
1969
1968
|
this.flowNode = undefined;
|
|
1969
|
+
this.symbol = undefined;
|
|
1970
1970
|
this.localSymbol = undefined;
|
|
1971
1971
|
}
|
|
1972
1972
|
|
|
@@ -2011,8 +2011,8 @@ export class TypeAliasDeclaration extends Node {
|
|
|
2011
2011
|
typeParameters: NodeList | undefined;
|
|
2012
2012
|
type: TypeNode;
|
|
2013
2013
|
// Set by the binder.
|
|
2014
|
-
symbol: Symbol | undefined;
|
|
2015
2014
|
flowNode: FlowNode | undefined;
|
|
2015
|
+
symbol: Symbol | undefined;
|
|
2016
2016
|
localSymbol: Symbol | undefined;
|
|
2017
2017
|
locals: SymbolTable | undefined;
|
|
2018
2018
|
nextContainer: Node | undefined;
|
|
@@ -2029,8 +2029,8 @@ export class TypeAliasDeclaration extends Node {
|
|
|
2029
2029
|
this.name = name;
|
|
2030
2030
|
this.typeParameters = typeParameters;
|
|
2031
2031
|
this.type = type;
|
|
2032
|
-
this.symbol = undefined;
|
|
2033
2032
|
this.flowNode = undefined;
|
|
2033
|
+
this.symbol = undefined;
|
|
2034
2034
|
this.localSymbol = undefined;
|
|
2035
2035
|
this.locals = undefined;
|
|
2036
2036
|
this.nextContainer = undefined;
|
|
@@ -2113,8 +2113,8 @@ export class EnumDeclaration extends Node {
|
|
|
2113
2113
|
name: Identifier;
|
|
2114
2114
|
members: NodeList;
|
|
2115
2115
|
// Set by the binder.
|
|
2116
|
-
symbol: Symbol | undefined;
|
|
2117
2116
|
flowNode: FlowNode | undefined;
|
|
2117
|
+
symbol: Symbol | undefined;
|
|
2118
2118
|
localSymbol: Symbol | undefined;
|
|
2119
2119
|
|
|
2120
2120
|
constructor(modifiers: ModifierList | undefined, name: Identifier, members: NodeList) {
|
|
@@ -2122,8 +2122,8 @@ export class EnumDeclaration extends Node {
|
|
|
2122
2122
|
this.modifiers = modifiers;
|
|
2123
2123
|
this.name = name;
|
|
2124
2124
|
this.members = members;
|
|
2125
|
-
this.symbol = undefined;
|
|
2126
2125
|
this.flowNode = undefined;
|
|
2126
|
+
this.symbol = undefined;
|
|
2127
2127
|
this.localSymbol = undefined;
|
|
2128
2128
|
}
|
|
2129
2129
|
|
|
@@ -2217,8 +2217,12 @@ export class NotEmittedStatement extends Node {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
2219
|
export class NotEmittedTypeElement extends Node {
|
|
2220
|
+
// Set by the binder.
|
|
2221
|
+
symbol: Symbol | undefined;
|
|
2222
|
+
|
|
2220
2223
|
constructor() {
|
|
2221
2224
|
super(SyntaxKind.NotEmittedTypeElement);
|
|
2225
|
+
this.symbol = undefined;
|
|
2222
2226
|
}
|
|
2223
2227
|
|
|
2224
2228
|
forEachChild(_v: NodeVisitor): boolean {
|
|
@@ -2396,8 +2400,8 @@ export class ExportAssignment extends Node {
|
|
|
2396
2400
|
type: TypeNode | undefined;
|
|
2397
2401
|
expression: Expression;
|
|
2398
2402
|
// Set by the binder.
|
|
2399
|
-
symbol: Symbol | undefined;
|
|
2400
2403
|
flowNode: FlowNode | undefined;
|
|
2404
|
+
symbol: Symbol | undefined;
|
|
2401
2405
|
|
|
2402
2406
|
constructor(
|
|
2403
2407
|
modifiers: ModifierList | undefined,
|
|
@@ -2410,8 +2414,8 @@ export class ExportAssignment extends Node {
|
|
|
2410
2414
|
this.isExportEquals = isExportEquals;
|
|
2411
2415
|
this.type = type;
|
|
2412
2416
|
this.expression = expression;
|
|
2413
|
-
this.symbol = undefined;
|
|
2414
2417
|
this.flowNode = undefined;
|
|
2418
|
+
this.symbol = undefined;
|
|
2415
2419
|
}
|
|
2416
2420
|
|
|
2417
2421
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -2448,15 +2452,15 @@ export class NamespaceExportDeclaration extends Node {
|
|
|
2448
2452
|
modifiers: ModifierList | undefined;
|
|
2449
2453
|
name: Identifier;
|
|
2450
2454
|
// Set by the binder.
|
|
2451
|
-
symbol: Symbol | undefined;
|
|
2452
2455
|
flowNode: FlowNode | undefined;
|
|
2456
|
+
symbol: Symbol | undefined;
|
|
2453
2457
|
|
|
2454
2458
|
constructor(modifiers: ModifierList | undefined, name: Identifier) {
|
|
2455
2459
|
super(SyntaxKind.NamespaceExportDeclaration);
|
|
2456
2460
|
this.modifiers = modifiers;
|
|
2457
2461
|
this.name = name;
|
|
2458
|
-
this.symbol = undefined;
|
|
2459
2462
|
this.flowNode = undefined;
|
|
2463
|
+
this.symbol = undefined;
|
|
2460
2464
|
}
|
|
2461
2465
|
|
|
2462
2466
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -6305,10 +6309,13 @@ export class JsxAttribute extends Node {
|
|
|
6305
6309
|
|
|
6306
6310
|
export class JsxSpreadAttribute extends Node {
|
|
6307
6311
|
expression: Expression;
|
|
6312
|
+
// Set by the binder.
|
|
6313
|
+
symbol: Symbol | undefined;
|
|
6308
6314
|
|
|
6309
6315
|
constructor(expression: Expression) {
|
|
6310
6316
|
super(SyntaxKind.JsxSpreadAttribute);
|
|
6311
6317
|
this.expression = expression;
|
|
6318
|
+
this.symbol = undefined;
|
|
6312
6319
|
}
|
|
6313
6320
|
|
|
6314
6321
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -7574,10 +7581,11 @@ export class ModuleDeclaration extends Node {
|
|
|
7574
7581
|
modifiers: ModifierList | undefined;
|
|
7575
7582
|
keyword: SyntaxKind;
|
|
7576
7583
|
name: ModuleName;
|
|
7584
|
+
attributes: TypeLiteralNode | undefined;
|
|
7577
7585
|
body: ModuleBody | undefined;
|
|
7578
7586
|
// Set by the binder.
|
|
7579
|
-
symbol: Symbol | undefined;
|
|
7580
7587
|
flowNode: FlowNode | undefined;
|
|
7588
|
+
symbol: Symbol | undefined;
|
|
7581
7589
|
localSymbol: Symbol | undefined;
|
|
7582
7590
|
locals: SymbolTable | undefined;
|
|
7583
7591
|
nextContainer: Node | undefined;
|
|
@@ -7587,15 +7595,17 @@ export class ModuleDeclaration extends Node {
|
|
|
7587
7595
|
modifiers: ModifierList | undefined,
|
|
7588
7596
|
keyword: SyntaxKind,
|
|
7589
7597
|
name: ModuleName,
|
|
7598
|
+
attributes: TypeLiteralNode | undefined,
|
|
7590
7599
|
body: ModuleBody | undefined,
|
|
7591
7600
|
) {
|
|
7592
7601
|
super(SyntaxKind.ModuleDeclaration);
|
|
7593
7602
|
this.modifiers = modifiers;
|
|
7594
7603
|
this.keyword = keyword;
|
|
7595
7604
|
this.name = name;
|
|
7605
|
+
this.attributes = attributes;
|
|
7596
7606
|
this.body = body;
|
|
7597
|
-
this.symbol = undefined;
|
|
7598
7607
|
this.flowNode = undefined;
|
|
7608
|
+
this.symbol = undefined;
|
|
7599
7609
|
this.localSymbol = undefined;
|
|
7600
7610
|
this.locals = undefined;
|
|
7601
7611
|
this.nextContainer = undefined;
|
|
@@ -7605,12 +7615,14 @@ export class ModuleDeclaration extends Node {
|
|
|
7605
7615
|
forEachChild(v: NodeVisitor): boolean {
|
|
7606
7616
|
if (this.modifiers !== undefined && v.visitModifiers(this.modifiers)) return true;
|
|
7607
7617
|
if (v.visitNode(this.name)) return true;
|
|
7618
|
+
if (this.attributes !== undefined && v.visitNode(this.attributes)) return true;
|
|
7608
7619
|
return this.body !== undefined && v.visitNode(this.body);
|
|
7609
7620
|
}
|
|
7610
7621
|
|
|
7611
7622
|
setParentOfChildren(): void {
|
|
7612
7623
|
if (this.modifiers !== undefined) setParents(this.modifiers.nodes, this);
|
|
7613
7624
|
this.name.parent = this;
|
|
7625
|
+
if (this.attributes !== undefined) this.attributes.parent = this;
|
|
7614
7626
|
if (this.body !== undefined) this.body.parent = this;
|
|
7615
7627
|
}
|
|
7616
7628
|
|
|
@@ -7623,6 +7635,7 @@ export class ModuleDeclaration extends Node {
|
|
|
7623
7635
|
this.modifiers === undefined ? undefined : cloneModifiers(this.modifiers),
|
|
7624
7636
|
this.keyword,
|
|
7625
7637
|
this.name.deepClone(),
|
|
7638
|
+
this.attributes === undefined ? undefined : this.attributes.copy(),
|
|
7626
7639
|
this.body === undefined ? undefined : this.body.deepClone(),
|
|
7627
7640
|
);
|
|
7628
7641
|
node.flags = this.flags;
|
|
@@ -7638,8 +7651,8 @@ export class ImportEqualsDeclaration extends Node {
|
|
|
7638
7651
|
name: Identifier;
|
|
7639
7652
|
moduleReference: ModuleReference;
|
|
7640
7653
|
// Set by the binder.
|
|
7641
|
-
symbol: Symbol | undefined;
|
|
7642
7654
|
flowNode: FlowNode | undefined;
|
|
7655
|
+
symbol: Symbol | undefined;
|
|
7643
7656
|
localSymbol: Symbol | undefined;
|
|
7644
7657
|
|
|
7645
7658
|
constructor(
|
|
@@ -7653,8 +7666,8 @@ export class ImportEqualsDeclaration extends Node {
|
|
|
7653
7666
|
this.isTypeOnly = isTypeOnly;
|
|
7654
7667
|
this.name = name;
|
|
7655
7668
|
this.moduleReference = moduleReference;
|
|
7656
|
-
this.symbol = undefined;
|
|
7657
7669
|
this.flowNode = undefined;
|
|
7670
|
+
this.symbol = undefined;
|
|
7658
7671
|
this.localSymbol = undefined;
|
|
7659
7672
|
}
|
|
7660
7673
|
|
|
@@ -7695,8 +7708,8 @@ export class ExportDeclaration extends Node {
|
|
|
7695
7708
|
moduleSpecifier: Expression | undefined;
|
|
7696
7709
|
attributes: ImportAttributes | undefined;
|
|
7697
7710
|
// Set by the binder.
|
|
7698
|
-
symbol: Symbol | undefined;
|
|
7699
7711
|
flowNode: FlowNode | undefined;
|
|
7712
|
+
symbol: Symbol | undefined;
|
|
7700
7713
|
|
|
7701
7714
|
constructor(
|
|
7702
7715
|
modifiers: ModifierList | undefined,
|
|
@@ -7711,8 +7724,8 @@ export class ExportDeclaration extends Node {
|
|
|
7711
7724
|
this.exportClause = exportClause;
|
|
7712
7725
|
this.moduleSpecifier = moduleSpecifier;
|
|
7713
7726
|
this.attributes = attributes;
|
|
7714
|
-
this.symbol = undefined;
|
|
7715
7727
|
this.flowNode = undefined;
|
|
7728
|
+
this.symbol = undefined;
|
|
7716
7729
|
}
|
|
7717
7730
|
|
|
7718
7731
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -8258,6 +8271,12 @@ export class SourceFile extends Node {
|
|
|
8258
8271
|
identifierCount: number;
|
|
8259
8272
|
nodeCount: number;
|
|
8260
8273
|
textCount: number;
|
|
8274
|
+
/** The API's binary encoding of this file, when an API server keeps it (`keptEncodingOf`). */
|
|
8275
|
+
apiEncoding: Uint8Array | undefined;
|
|
8276
|
+
/** The symbols the file owns, by id, as API file symbol references resolve them; made on first use. */
|
|
8277
|
+
apiSymbolIndex: Map<number, Symbol> | undefined;
|
|
8278
|
+
/** The xxh3-128 hash of the text in API source file descriptors, as hexadecimal digits; `''` until first use. */
|
|
8279
|
+
apiContentHash: string;
|
|
8261
8280
|
/** Module specifiers of imports, exports, `require` calls and `import()` types, in source order. */
|
|
8262
8281
|
imports: Node[];
|
|
8263
8282
|
/** Names of `declare module "x"` augmentations and `declare global` blocks in modules. */
|
|
@@ -8290,8 +8309,6 @@ export class SourceFile extends Node {
|
|
|
8290
8309
|
nextContainer: Node | undefined;
|
|
8291
8310
|
isBound: boolean;
|
|
8292
8311
|
bindDiagnostics: readonly Diagnostic[];
|
|
8293
|
-
/** The flow at the end of the file. */
|
|
8294
|
-
endFlowNode: FlowNode | undefined;
|
|
8295
8312
|
symbolCount: number;
|
|
8296
8313
|
/** Ambient modules with a `*` in their name, like `declare module "*.css"`. */
|
|
8297
8314
|
patternAmbientModules: readonly PatternAmbientModule[];
|
|
@@ -8325,6 +8342,9 @@ export class SourceFile extends Node {
|
|
|
8325
8342
|
this.identifierCount = 0;
|
|
8326
8343
|
this.nodeCount = 0;
|
|
8327
8344
|
this.textCount = 0;
|
|
8345
|
+
this.apiEncoding = undefined;
|
|
8346
|
+
this.apiSymbolIndex = undefined;
|
|
8347
|
+
this.apiContentHash = '';
|
|
8328
8348
|
this.imports = [];
|
|
8329
8349
|
this.moduleAugmentations = emptyNodes;
|
|
8330
8350
|
this.ambientModuleNames = emptyStrings;
|
|
@@ -8345,7 +8365,6 @@ export class SourceFile extends Node {
|
|
|
8345
8365
|
this.nextContainer = undefined;
|
|
8346
8366
|
this.isBound = false;
|
|
8347
8367
|
this.bindDiagnostics = emptyDiagnostics;
|
|
8348
|
-
this.endFlowNode = undefined;
|
|
8349
8368
|
this.symbolCount = 0;
|
|
8350
8369
|
this.patternAmbientModules = emptyPatternAmbientModules;
|
|
8351
8370
|
this.globalExports = undefined;
|
|
@@ -10711,6 +10730,7 @@ export function isDeclarationNode(node: Node): boolean {
|
|
|
10711
10730
|
case SyntaxKind.ConstructorType:
|
|
10712
10731
|
case SyntaxKind.JsxAttributes:
|
|
10713
10732
|
case SyntaxKind.JsxAttribute:
|
|
10733
|
+
case SyntaxKind.JsxSpreadAttribute:
|
|
10714
10734
|
case SyntaxKind.JSDocSignature:
|
|
10715
10735
|
case SyntaxKind.SourceFile:
|
|
10716
10736
|
case SyntaxKind.ModuleDeclaration:
|
|
@@ -11035,6 +11055,12 @@ export function getSymbol(node: Node): Symbol | undefined {
|
|
|
11035
11055
|
return holder.symbol;
|
|
11036
11056
|
}
|
|
11037
11057
|
break;
|
|
11058
|
+
case SyntaxKind.JsxSpreadAttribute:
|
|
11059
|
+
if (node instanceof JsxSpreadAttribute) {
|
|
11060
|
+
const holder: JsxSpreadAttribute = node;
|
|
11061
|
+
return holder.symbol;
|
|
11062
|
+
}
|
|
11063
|
+
break;
|
|
11038
11064
|
case SyntaxKind.JSDocSignature:
|
|
11039
11065
|
if (node instanceof JSDocSignature) {
|
|
11040
11066
|
const holder: JSDocSignature = node;
|
|
@@ -11367,6 +11393,12 @@ export function setSymbol(node: Node, value: Symbol | undefined): void {
|
|
|
11367
11393
|
target.symbol = value;
|
|
11368
11394
|
}
|
|
11369
11395
|
break;
|
|
11396
|
+
case SyntaxKind.JsxSpreadAttribute:
|
|
11397
|
+
if (node instanceof JsxSpreadAttribute) {
|
|
11398
|
+
const target: JsxSpreadAttribute = node;
|
|
11399
|
+
target.symbol = value;
|
|
11400
|
+
}
|
|
11401
|
+
break;
|
|
11370
11402
|
case SyntaxKind.JSDocSignature:
|
|
11371
11403
|
if (node instanceof JSDocSignature) {
|
|
11372
11404
|
const target: JSDocSignature = node;
|
package/src/compiler/binder.ts
CHANGED
|
@@ -30,6 +30,7 @@ import {
|
|
|
30
30
|
MetaProperty,
|
|
31
31
|
ModifierFlags,
|
|
32
32
|
ModuleDeclaration,
|
|
33
|
+
getNodeId,
|
|
33
34
|
type Node,
|
|
34
35
|
NonNullExpression,
|
|
35
36
|
NodeFlags,
|
|
@@ -590,7 +591,16 @@ class Binder extends NodeVisitor {
|
|
|
590
591
|
if (name !== undefined) {
|
|
591
592
|
if (isAmbientModule(node)) {
|
|
592
593
|
if (isGlobalScopeAugmentation(node)) return InternalSymbolName.Global;
|
|
593
|
-
|
|
594
|
+
const moduleName = nodeText(name);
|
|
595
|
+
// A pattern module with import attributes has its own symbol, named after the attributes node's id: it merges
|
|
596
|
+
// only with pattern modules of the same pattern and identical attributes, which the checker decides. The id
|
|
597
|
+
// is written at a fixed width so that names sort in declaration order.
|
|
598
|
+
const attributes = (node as ModuleDeclaration).attributes;
|
|
599
|
+
if (attributes !== undefined && hasSingleStar(moduleName))
|
|
600
|
+
return (
|
|
601
|
+
internalSymbolNamePrefix + '"' + moduleName + '"pattern@' + String(getNodeId(attributes)).padStart(10, '0')
|
|
602
|
+
);
|
|
603
|
+
return '"' + moduleName + '"';
|
|
594
604
|
}
|
|
595
605
|
if (name.kind === SyntaxKind.PrivateIdentifier) {
|
|
596
606
|
// Private names are only allowed in classes; elsewhere there is already a parse error.
|
|
@@ -1116,7 +1126,6 @@ class Binder extends NodeVisitor {
|
|
|
1116
1126
|
if (this.seenThisKeyword) node.flags |= NodeFlags.ContainsThis;
|
|
1117
1127
|
if (node.kind === SyntaxKind.SourceFile) {
|
|
1118
1128
|
node.flags |= this.emitFlags;
|
|
1119
|
-
(node as SourceFile).endFlowNode = this.currentFlow;
|
|
1120
1129
|
}
|
|
1121
1130
|
const returnTarget = this.currentReturnTarget;
|
|
1122
1131
|
if (returnTarget !== undefined) {
|
|
@@ -1516,11 +1525,19 @@ class Binder extends NodeVisitor {
|
|
|
1516
1525
|
}
|
|
1517
1526
|
|
|
1518
1527
|
bindForStatement(node: ForStatement): void {
|
|
1528
|
+
this.bindOptional(node.initializer);
|
|
1529
|
+
if (this.currentFlow === this.unreachableFlow) {
|
|
1530
|
+
// An initializer that ends the flow (a throwing IIFE) would leave the loop label only the
|
|
1531
|
+
// incrementor's back edge: a cycle with no entry. Bind the rest as unreachable.
|
|
1532
|
+
this.bindOptional(node.condition);
|
|
1533
|
+
this.bind(node.statement);
|
|
1534
|
+
this.bindOptional(node.incrementor);
|
|
1535
|
+
return;
|
|
1536
|
+
}
|
|
1519
1537
|
const preLoopLabel = this.setContinueTarget(node, this.createLoopLabel());
|
|
1520
1538
|
const preBodyLabel = this.createBranchLabel();
|
|
1521
1539
|
const preIncrementorLabel = this.createBranchLabel();
|
|
1522
1540
|
const postLoopLabel = this.createBranchLabel();
|
|
1523
|
-
this.bindOptional(node.initializer);
|
|
1524
1541
|
this.addAntecedent(preLoopLabel, this.currentFlow);
|
|
1525
1542
|
this.currentFlow = preLoopLabel;
|
|
1526
1543
|
this.bindCondition(node.condition, preBodyLabel, postLoopLabel);
|
|
@@ -1534,9 +1551,15 @@ class Binder extends NodeVisitor {
|
|
|
1534
1551
|
}
|
|
1535
1552
|
|
|
1536
1553
|
bindForInOrForOfStatement(node: ForInOrOfStatement): void {
|
|
1554
|
+
this.bind(node.expression);
|
|
1555
|
+
if (this.currentFlow === this.unreachableFlow) {
|
|
1556
|
+
// As for a `for` initializer: an expression that ends the flow leaves the loop unreachable.
|
|
1557
|
+
this.bind(node.initializer);
|
|
1558
|
+
this.bind(node.statement);
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1537
1561
|
const preLoopLabel = this.setContinueTarget(node, this.createLoopLabel());
|
|
1538
1562
|
const postLoopLabel = this.createBranchLabel();
|
|
1539
|
-
this.bind(node.expression);
|
|
1540
1563
|
this.addAntecedent(preLoopLabel, this.currentFlow);
|
|
1541
1564
|
this.currentFlow = preLoopLabel;
|
|
1542
1565
|
if (node.kind === SyntaxKind.ForOfStatement) this.bindOptional(node.awaitModifier);
|
|
@@ -1980,6 +2003,12 @@ class Binder extends NodeVisitor {
|
|
|
1980
2003
|
this.file.patternAmbientModules,
|
|
1981
2004
|
new PatternAmbientModule(text, starIndex, symbol),
|
|
1982
2005
|
);
|
|
2006
|
+
else if (node.attributes !== undefined)
|
|
2007
|
+
this.errorOnNode(
|
|
2008
|
+
name,
|
|
2009
|
+
Diagnostics.An_ambient_module_declaration_with_import_attributes_must_use_a_pattern_name_with_an_Asterisk_character,
|
|
2010
|
+
noArgs,
|
|
2011
|
+
);
|
|
1983
2012
|
}
|
|
1984
2013
|
return;
|
|
1985
2014
|
}
|
|
@@ -2711,3 +2740,9 @@ export function findUseStrictPrologue(file: SourceFile, statements: readonly Nod
|
|
|
2711
2740
|
}
|
|
2712
2741
|
return undefined;
|
|
2713
2742
|
}
|
|
2743
|
+
|
|
2744
|
+
/** Whether a module name is a pattern with exactly one `*`. */
|
|
2745
|
+
function hasSingleStar(text: string): boolean {
|
|
2746
|
+
const star = text.indexOf('*');
|
|
2747
|
+
return star >= 0 && text.indexOf('*', star + 1) < 0;
|
|
2748
|
+
}
|
|
@@ -295,8 +295,8 @@ export function isIdentifierPart(codePoint: number, languageVariant = LanguageVa
|
|
|
295
295
|
isWordCharacter(codePoint) ||
|
|
296
296
|
codePoint === CharacterCodes.$ ||
|
|
297
297
|
(codePoint > CharacterCodes.maxAsciiCharacter && isUnicodeIdentifierPart(codePoint)) ||
|
|
298
|
-
|
|
299
|
-
|
|
298
|
+
// `:` is part of a JSX namespaced name, but not of a JSX identifier.
|
|
299
|
+
(languageVariant === LanguageVariant.JSX && codePoint === CharacterCodes.minus)
|
|
300
300
|
);
|
|
301
301
|
}
|
|
302
302
|
|