tsc-ts 0.0.10 → 0.1.1
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 +1 -1
- 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 +29 -18
- package/dist/api/compiler/ast.js +1040 -1007
- 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 +173 -123
- package/dist/api/compiler/checker-classes.d.ts +14 -3
- package/dist/api/compiler/checker-classes.js +136 -91
- package/dist/api/compiler/checker-contextual.d.ts +20 -0
- package/dist/api/compiler/checker-contextual.js +175 -62
- 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 +258 -212
- 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 +469 -438
- 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 -113
- 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 +107 -89
- package/dist/api/compiler/checker-members.d.ts +9 -2
- package/dist/api/compiler/checker-members.js +210 -74
- 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 +190 -46
- 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 +97 -31
- package/dist/api/compiler/checker.js +149 -35
- 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 +24 -4
- package/dist/api/compiler/compile-program.js +53 -26
- package/dist/api/compiler/diagnostic-messages.d.ts +1849 -1774
- package/dist/api/compiler/diagnostic-messages.js +128 -122
- package/dist/api/compiler/diagnostics.js +7 -7
- package/dist/api/compiler/emitter.d.ts +7 -1
- package/dist/api/compiler/emitter.js +53 -11
- package/dist/api/compiler/expr-record.d.ts +11 -0
- package/dist/api/compiler/expr-record.js +53 -0
- 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 +10 -0
- package/dist/api/compiler/file-loader.js +138 -41
- package/dist/api/compiler/identifier-name.d.ts +9 -0
- package/dist/api/compiler/identifier-name.js +10 -0
- package/dist/api/compiler/instantiation.d.ts +7 -0
- package/dist/api/compiler/instantiation.js +101 -49
- package/dist/api/compiler/jsdoc.js +27 -25
- 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/parser.d.ts +42 -20
- package/dist/api/compiler/parser.js +318 -224
- 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 +3 -1
- package/dist/api/compiler/printer/emit-context.js +16 -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 +6 -3
- 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 +1 -0
- package/dist/api/compiler/printer/printer.js +306 -283
- package/dist/api/compiler/printer/utilities.js +149 -147
- package/dist/api/compiler/program-checker.d.ts +8 -2
- package/dist/api/compiler/program-checker.js +84 -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 +2 -0
- package/dist/api/compiler/program.js +69 -57
- 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 +337 -180
- package/dist/api/compiler/reparser.js +64 -59
- package/dist/api/compiler/scanner.d.ts +27 -2
- package/dist/api/compiler/scanner.js +181 -150
- package/dist/api/compiler/shared-results.d.ts +696 -0
- package/dist/api/compiler/shared-results.js +2905 -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 +22 -13
- package/dist/api/compiler/symbol.js +15 -1
- 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 +307 -239
- 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 +74 -38
- package/src/compiler/binder.ts +39 -4
- package/src/compiler/cgroup.ts +157 -0
- package/src/compiler/character-codes.ts +2 -2
- package/src/compiler/checker-calls.ts +76 -8
- package/src/compiler/checker-classes.ts +80 -25
- package/src/compiler/checker-contextual.ts +110 -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 +95 -47
- package/src/compiler/checker-functions.ts +21 -6
- package/src/compiler/checker-generated-code.ts +2 -22
- package/src/compiler/checker-grammar.ts +133 -60
- package/src/compiler/checker-heritage.ts +22 -21
- package/src/compiler/checker-inference.ts +514 -87
- 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 +28 -5
- package/src/compiler/checker-members.ts +197 -55
- 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 +173 -35
- 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 +175 -41
- package/src/compiler/command-line.ts +28 -28
- package/src/compiler/compile-program.ts +59 -25
- package/src/compiler/decoder.ts +15 -5
- package/src/compiler/diagnostic-messages.ts +1973 -1892
- package/src/compiler/doctor-report.ts +133 -0
- package/src/compiler/emitter.ts +57 -8
- package/src/compiler/encoder.ts +23 -8
- package/src/compiler/expr-record.ts +59 -0
- package/src/compiler/file-include.ts +9 -3
- package/src/compiler/file-loader.ts +139 -32
- package/src/compiler/help.ts +10 -14
- package/src/compiler/identifier-name.ts +13 -0
- package/src/compiler/incremental.ts +86 -18
- package/src/compiler/init.ts +2 -7
- package/src/compiler/instantiation.ts +77 -22
- package/src/compiler/jsdoc.ts +7 -3
- 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 +543 -147
- package/src/compiler/parallel-emit.ts +4 -4
- package/src/compiler/parser.ts +166 -47
- package/src/compiler/path.ts +22 -2
- package/src/compiler/printer/emit-context.ts +16 -0
- package/src/compiler/printer/factory-base.ts +10 -3
- package/src/compiler/printer/factory.ts +7 -3
- package/src/compiler/printer/helpers.ts +10 -1
- package/src/compiler/printer/name-generator.ts +24 -2
- package/src/compiler/printer/printer.ts +39 -16
- package/src/compiler/printer/utilities.ts +8 -2
- package/src/compiler/program-checker.ts +53 -5
- package/src/compiler/program-utilities.ts +23 -10
- package/src/compiler/program.ts +13 -1
- package/src/compiler/pseudo-bigint.ts +17 -0
- package/src/compiler/regexp-checker.ts +63 -30
- package/src/compiler/relations.ts +233 -77
- package/src/compiler/reparser.ts +14 -5
- package/src/compiler/run-config.ts +1383 -0
- package/src/compiler/run-record-read.ts +87 -0
- package/src/compiler/run-records.ts +575 -0
- package/src/compiler/scanner.ts +166 -120
- package/src/compiler/shared-results.ts +3144 -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 +31 -14
- package/src/compiler/syntax-kind.ts +188 -187
- package/src/compiler/thread-entry.ts +22 -3
- 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 +136 -49
- 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 +67 -6
- package/src/compiler/tsc-cli.ts +35 -4
- package/src/compiler/tsc-compile.ts +220 -10
- package/src/compiler/tsc-watch.ts +97 -47
- 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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { charSize, codePointAt, isASCIILetter, isDigit, isHexDigit, isIdentifierPart, isIdentifierStart, isLineBreak, isOctalDigit, isWhiteSpaceLike, isWhiteSpaceSingleLine, } from './character-codes.js';
|
|
2
|
+
import { IdentifierName } from './identifier-name.js';
|
|
2
3
|
import { parsePseudoBigInt } from './pseudo-bigint.js';
|
|
3
4
|
import { checkRegularExpression, regularExpressionFlag, } from './regexp-checker.js';
|
|
4
5
|
import { CommentDirective, CommentRange, } from './types.js';
|
|
@@ -66,6 +67,7 @@ const textToKeyword = new Map([
|
|
|
66
67
|
['return', 106 /* SyntaxKind.ReturnKeyword */],
|
|
67
68
|
['satisfies', 152 /* SyntaxKind.SatisfiesKeyword */],
|
|
68
69
|
['set', 153 /* SyntaxKind.SetKeyword */],
|
|
70
|
+
['source', 167 /* SyntaxKind.SourceKeyword */],
|
|
69
71
|
['static', 125 /* SyntaxKind.StaticKeyword */],
|
|
70
72
|
['string', 154 /* SyntaxKind.StringKeyword */],
|
|
71
73
|
['super', 107 /* SyntaxKind.SuperKeyword */],
|
|
@@ -154,7 +156,7 @@ const textToToken = new Map([
|
|
|
154
156
|
['`', 61 /* SyntaxKind.BacktickToken */],
|
|
155
157
|
]);
|
|
156
158
|
const tokenToText = [];
|
|
157
|
-
for (let kind = 0; kind <=
|
|
159
|
+
for (let kind = 0; kind <= 167 /* SyntaxKind.LastToken */; kind++)
|
|
158
160
|
tokenToText.push('');
|
|
159
161
|
for (const [text, kind] of textToToken)
|
|
160
162
|
tokenToText[kind] = text;
|
|
@@ -307,58 +309,58 @@ function rangeHash(chars, start, end) {
|
|
|
307
309
|
function finishHash(hash) {
|
|
308
310
|
return hash ^ (hash >>> 15);
|
|
309
311
|
}
|
|
310
|
-
/**
|
|
312
|
+
/**
|
|
313
|
+
* Names for ranges of one text, keyed by their code units: equal identifiers share one
|
|
314
|
+
* `IdentifierName`.
|
|
315
|
+
*/
|
|
311
316
|
class IdentifierTable {
|
|
312
|
-
text;
|
|
313
317
|
// Pairs of (entry index + 1, hash) per slot, (0, 0) when empty; linear probing.
|
|
314
318
|
slots;
|
|
315
319
|
// Each entry's length in code units.
|
|
316
320
|
lengths;
|
|
317
|
-
|
|
321
|
+
names;
|
|
318
322
|
count;
|
|
319
|
-
// Per entry: 1 once its
|
|
323
|
+
// Per entry: 1 once its name was recorded among the file's identifier texts (`markRecorded`).
|
|
320
324
|
recorded;
|
|
321
|
-
|
|
322
|
-
lastEntry;
|
|
323
|
-
constructor(text) {
|
|
324
|
-
this.text = text;
|
|
325
|
+
constructor() {
|
|
325
326
|
this.slots = new Int32Array(512);
|
|
326
327
|
this.lengths = new Int32Array(128);
|
|
327
|
-
this.
|
|
328
|
+
this.names = [];
|
|
328
329
|
this.count = 0;
|
|
329
330
|
this.recorded = new Uint8Array(128);
|
|
330
|
-
|
|
331
|
+
}
|
|
332
|
+
/** Empties the table for a new text. */
|
|
333
|
+
clear() {
|
|
334
|
+
if (this.count === 0)
|
|
335
|
+
return;
|
|
336
|
+
this.slots.fill(0);
|
|
337
|
+
this.names.length = 0;
|
|
338
|
+
this.recorded.fill(0, 0, this.count);
|
|
339
|
+
this.count = 0;
|
|
331
340
|
}
|
|
332
341
|
/**
|
|
333
|
-
* Whether `text`,
|
|
334
|
-
* texts; marks it recorded. Texts the table doesn't know are
|
|
342
|
+
* Whether `text`, the text of the entry `entry` that `intern` returned (-1 for none), still needs
|
|
343
|
+
* recording among the file's identifier texts; marks it recorded. Texts the table doesn't know are
|
|
344
|
+
* always recorded.
|
|
335
345
|
*/
|
|
336
|
-
markRecorded(text) {
|
|
337
|
-
|
|
338
|
-
if (entry < 0 || this.texts[entry] !== text)
|
|
346
|
+
markRecorded(entry, text) {
|
|
347
|
+
if (entry < 0 || this.names[entry].text !== text)
|
|
339
348
|
return true;
|
|
340
349
|
if (this.recorded[entry] !== 0)
|
|
341
350
|
return false;
|
|
342
351
|
this.recorded[entry] = 1;
|
|
343
352
|
return true;
|
|
344
353
|
}
|
|
345
|
-
/**
|
|
346
|
-
|
|
347
|
-
this.
|
|
348
|
-
if (this.count === 0)
|
|
349
|
-
return;
|
|
350
|
-
this.slots.fill(0);
|
|
351
|
-
this.recorded.fill(0, 0, this.count);
|
|
352
|
-
this.texts.length = 0;
|
|
353
|
-
this.count = 0;
|
|
354
|
-
this.lastEntry = -1;
|
|
354
|
+
/** The name of the entry `intern` returned. */
|
|
355
|
+
name(entry) {
|
|
356
|
+
return this.names[entry];
|
|
355
357
|
}
|
|
356
358
|
/**
|
|
357
|
-
* `text.substring(start, end)`,
|
|
358
|
-
* A candidate of the same hash and length is compared with `startsWith`, which natively
|
|
359
|
-
* the bytes of both strings at once.
|
|
359
|
+
* The entry of `text.substring(start, end)`, added when the table has no equal range; `hash` is its
|
|
360
|
+
* `rangeHash`. A candidate of the same hash and length is compared with `startsWith`, which natively
|
|
361
|
+
* compares the bytes of both strings at once.
|
|
360
362
|
*/
|
|
361
|
-
intern(start, end, hash) {
|
|
363
|
+
intern(text, start, end, hash) {
|
|
362
364
|
start = start | 0;
|
|
363
365
|
end = end | 0;
|
|
364
366
|
hash = hash | 0;
|
|
@@ -371,15 +373,11 @@ class IdentifierTable {
|
|
|
371
373
|
if (entry === 0)
|
|
372
374
|
break;
|
|
373
375
|
if ((slots[(slot * 2 + 1) | 0] | 0) === hash && (this.lengths[(entry - 1) | 0] | 0) === length) {
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
this.lastEntry = (entry - 1) | 0;
|
|
377
|
-
return candidate;
|
|
378
|
-
}
|
|
376
|
+
if (text.startsWith(this.names[(entry - 1) | 0].text, start))
|
|
377
|
+
return (entry - 1) | 0;
|
|
379
378
|
}
|
|
380
379
|
slot = (slot + 1) & mask;
|
|
381
380
|
}
|
|
382
|
-
const value = this.text.substring(start, end);
|
|
383
381
|
const index = this.count | 0;
|
|
384
382
|
if (index === this.lengths.length) {
|
|
385
383
|
const lengths = new Int32Array(index * 2);
|
|
@@ -390,14 +388,13 @@ class IdentifierTable {
|
|
|
390
388
|
this.recorded = recorded;
|
|
391
389
|
}
|
|
392
390
|
this.lengths[index] = length;
|
|
393
|
-
this.
|
|
391
|
+
this.names.push(new IdentifierName(text.substring(start, end)));
|
|
394
392
|
this.count = (index + 1) | 0;
|
|
395
|
-
this.lastEntry = index;
|
|
396
393
|
slots[(slot * 2) | 0] = (index + 1) | 0;
|
|
397
394
|
slots[(slot * 2 + 1) | 0] = hash;
|
|
398
395
|
if (this.count * 2 > mask + 1)
|
|
399
396
|
this.slots = rehash(slots);
|
|
400
|
-
return
|
|
397
|
+
return index;
|
|
401
398
|
}
|
|
402
399
|
}
|
|
403
400
|
/** `IdentifierTable` slots in a table twice the size. */
|
|
@@ -545,6 +542,8 @@ export class Scanner {
|
|
|
545
542
|
// so identifiers and keywords don't allocate until their value is read.
|
|
546
543
|
/** @internal */ tokenValue;
|
|
547
544
|
/** @internal */ valueStart;
|
|
545
|
+
// The name `getIdentifierValue` last interned, whose text `tokenValue` then holds.
|
|
546
|
+
tokenName;
|
|
548
547
|
/** @internal */ valueEnd;
|
|
549
548
|
// `rangeHash` of `chars[hashStart, hashEnd)`, which the ASCII identifier scan computes as it goes.
|
|
550
549
|
valueHash;
|
|
@@ -555,6 +554,8 @@ export class Scanner {
|
|
|
555
554
|
// The code units zeroed by `setTextEnd`.
|
|
556
555
|
cutUnits;
|
|
557
556
|
identifiers;
|
|
557
|
+
// The entry `getIdentifierValue` last interned, -1 for none.
|
|
558
|
+
lastEntry;
|
|
558
559
|
// With code units on demand: per block of `unitBlockSize` code units, 1 once `chars` holds them
|
|
559
560
|
// (`loadUnits`); `chars` is zero elsewhere.
|
|
560
561
|
loadedBlocks;
|
|
@@ -593,6 +594,7 @@ export class Scanner {
|
|
|
593
594
|
this.tokenFlags = 0 /* TokenFlags.None */;
|
|
594
595
|
this.tokenValue = '';
|
|
595
596
|
this.valueStart = -1;
|
|
597
|
+
this.tokenName = undefined;
|
|
596
598
|
this.valueEnd = -1;
|
|
597
599
|
this.valueHash = 0;
|
|
598
600
|
this.hashStart = -1;
|
|
@@ -600,7 +602,8 @@ export class Scanner {
|
|
|
600
602
|
this.commentDirectives = [];
|
|
601
603
|
this.skipJSDocLeadingAsterisks = 0;
|
|
602
604
|
this.cutUnits = new Uint16Array(4);
|
|
603
|
-
this.identifiers = new IdentifierTable(
|
|
605
|
+
this.identifiers = new IdentifierTable();
|
|
606
|
+
this.lastEntry = -1;
|
|
604
607
|
this.textKind = 0 /* TextKind.Unknown */;
|
|
605
608
|
this.lineFeedFrom = -1;
|
|
606
609
|
this.lineFeedAt = -1;
|
|
@@ -612,7 +615,8 @@ export class Scanner {
|
|
|
612
615
|
this.text = text;
|
|
613
616
|
this.chars = toCodeUnits(text);
|
|
614
617
|
this.loadedBlocks = undefined;
|
|
615
|
-
this.identifiers.
|
|
618
|
+
this.identifiers.clear();
|
|
619
|
+
this.lastEntry = -1;
|
|
616
620
|
this.textKind = 0 /* TextKind.Unknown */;
|
|
617
621
|
this.lineFeedFrom = -1;
|
|
618
622
|
this.lineFeedAt = -1;
|
|
@@ -736,7 +740,7 @@ export class Scanner {
|
|
|
736
740
|
* file to be recorded; files record each identifier text once.
|
|
737
741
|
*/
|
|
738
742
|
recordIdentifierValue(text) {
|
|
739
|
-
return this.identifiers.markRecorded(text);
|
|
743
|
+
return this.identifiers.markRecorded(this.lastEntry, text);
|
|
740
744
|
}
|
|
741
745
|
/** @internal Like `getTokenValue`, but identifiers with the same text share one string. */
|
|
742
746
|
getIdentifierValue() {
|
|
@@ -744,11 +748,24 @@ export class Scanner {
|
|
|
744
748
|
if (start >= 0) {
|
|
745
749
|
const end = this.valueEnd;
|
|
746
750
|
const hash = start === this.hashStart && end === this.hashEnd ? this.valueHash : rangeHash(this.chars, start, end);
|
|
747
|
-
|
|
751
|
+
const entry = this.identifiers.intern(this.text, start, end, hash);
|
|
752
|
+
this.lastEntry = entry;
|
|
753
|
+
this.tokenName = this.identifiers.name(entry);
|
|
754
|
+
this.tokenValue = this.tokenName.text;
|
|
748
755
|
this.valueStart = -1;
|
|
749
756
|
}
|
|
750
757
|
return this.tokenValue;
|
|
751
758
|
}
|
|
759
|
+
/**
|
|
760
|
+
* The identifier value as a name that identifiers with the same text share, after
|
|
761
|
+
* `getIdentifierValue`; a cooked value (with escapes) gets a name of its own.
|
|
762
|
+
*/
|
|
763
|
+
getIdentifierName() {
|
|
764
|
+
const name = this.tokenName;
|
|
765
|
+
if (name !== undefined && name.text === this.tokenValue)
|
|
766
|
+
return name;
|
|
767
|
+
return new IdentifierName(this.tokenValue);
|
|
768
|
+
}
|
|
752
769
|
getCommentDirectives() {
|
|
753
770
|
return this.commentDirectives;
|
|
754
771
|
}
|
|
@@ -1209,36 +1226,21 @@ export class Scanner {
|
|
|
1209
1226
|
case 64 /* CharacterCodes.at */:
|
|
1210
1227
|
this.pos = (this.pos + 1) | 0;
|
|
1211
1228
|
return (this.token = 59 /* SyntaxKind.AtToken */);
|
|
1212
|
-
case 92 /* CharacterCodes.backslash */:
|
|
1213
|
-
|
|
1214
|
-
if (codePoint >= 0 && isIdentifierStart(codePoint)) {
|
|
1215
|
-
const head = String.fromCodePoint(this.scanUnicodeEscape(true));
|
|
1216
|
-
this.setValue(head + this.scanIdentifierParts());
|
|
1229
|
+
case 92 /* CharacterCodes.backslash */:
|
|
1230
|
+
if (this.scanIdentifier(0, 0 /* IdentifierVariant.Standard */))
|
|
1217
1231
|
return (this.token = getIdentifierToken(this.tokenValue));
|
|
1218
|
-
}
|
|
1219
1232
|
return this.scanInvalidCharacter();
|
|
1220
|
-
}
|
|
1221
1233
|
case 35 /* CharacterCodes.hash */:
|
|
1222
1234
|
if ((chars[this.pos + 1] | 0) === 33 /* CharacterCodes.exclamation */) {
|
|
1223
1235
|
if (this.pos === 0) {
|
|
1224
1236
|
this.pos = scanShebangTrivia(this.text, 0) | 0;
|
|
1225
1237
|
continue;
|
|
1226
1238
|
}
|
|
1227
|
-
this.errorAt(
|
|
1228
|
-
this.pos = (this.pos +
|
|
1239
|
+
this.errorAt(1863 /* Diagnostics.X_can_only_be_used_at_the_start_of_a_file */, this.pos, 2, noArgs);
|
|
1240
|
+
this.pos = (this.pos + 2) | 0;
|
|
1229
1241
|
return (this.token = 0 /* SyntaxKind.Unknown */);
|
|
1230
1242
|
}
|
|
1231
|
-
if (
|
|
1232
|
-
this.pos = (this.pos + 1) | 0;
|
|
1233
|
-
const codePoint = this.peekUnicodeEscape();
|
|
1234
|
-
if (codePoint >= 0 && isIdentifierStart(codePoint)) {
|
|
1235
|
-
const head = '#' + String.fromCodePoint(this.scanUnicodeEscape(true));
|
|
1236
|
-
this.setValue(head + this.scanIdentifierParts());
|
|
1237
|
-
return (this.token = 80 /* SyntaxKind.PrivateIdentifier */);
|
|
1238
|
-
}
|
|
1239
|
-
this.pos = (this.pos - 1) | 0;
|
|
1240
|
-
}
|
|
1241
|
-
if (!this.scanIdentifier(1)) {
|
|
1243
|
+
if (!this.scanIdentifier(1, 0 /* IdentifierVariant.Standard */)) {
|
|
1242
1244
|
this.errorAt(94 /* Diagnostics.Invalid_character */, this.pos - 1, 1, noArgs);
|
|
1243
1245
|
this.setValue('#');
|
|
1244
1246
|
}
|
|
@@ -1246,11 +1248,11 @@ export class Scanner {
|
|
|
1246
1248
|
default: {
|
|
1247
1249
|
if (ch < 0)
|
|
1248
1250
|
return (this.token = 1 /* SyntaxKind.EndOfFile */);
|
|
1249
|
-
if (this.scanIdentifier(0))
|
|
1251
|
+
if (this.scanIdentifier(0, 0 /* IdentifierVariant.Standard */))
|
|
1250
1252
|
return (this.token = this.identifierKind());
|
|
1251
1253
|
const codePoint = this.codePoint();
|
|
1252
1254
|
if (codePoint === 65533 /* CharacterCodes.replacementCharacter */) {
|
|
1253
|
-
this.errorAt(
|
|
1255
|
+
this.errorAt(403 /* Diagnostics.File_appears_to_be_binary */, 0, 0, noArgs);
|
|
1254
1256
|
this.pos = this.end;
|
|
1255
1257
|
return (this.token = 7 /* SyntaxKind.NonTextFileMarkerTrivia */);
|
|
1256
1258
|
}
|
|
@@ -1441,14 +1443,38 @@ export class Scanner {
|
|
|
1441
1443
|
return;
|
|
1442
1444
|
this.commentDirectives.push(new CommentDirective(start, end, kind));
|
|
1443
1445
|
}
|
|
1444
|
-
/**
|
|
1445
|
-
|
|
1446
|
+
/**
|
|
1447
|
+
* @internal Scans an identifier after `prefixLength` units; sets the token value. `variant`
|
|
1448
|
+
* decides the identifier parts: JSX and JSDoc names also take `-`, and regular expression group
|
|
1449
|
+
* names take a surrogate pair written as two `\u` escapes.
|
|
1450
|
+
*/
|
|
1451
|
+
scanIdentifier(prefixLength, variant) {
|
|
1446
1452
|
const text = this.text;
|
|
1447
1453
|
const chars = this.chars;
|
|
1448
1454
|
const start = this.pos;
|
|
1449
1455
|
this.pos = (this.pos + prefixLength) | 0;
|
|
1456
|
+
const identifierStart = this.pos;
|
|
1450
1457
|
let ch = this.char();
|
|
1451
|
-
if (
|
|
1458
|
+
if (variant === 1 /* IdentifierVariant.JSX */) {
|
|
1459
|
+
if (isASCIILetter(ch) || ch === 95 /* CharacterCodes._ */ || ch === 36 /* CharacterCodes.$ */) {
|
|
1460
|
+
// ASCII names, as the general loop below scans them.
|
|
1461
|
+
let pos = (this.pos + 1) | 0;
|
|
1462
|
+
const end = this.end;
|
|
1463
|
+
while (pos < end) {
|
|
1464
|
+
const c = chars[pos] | 0;
|
|
1465
|
+
if (!isASCIIIdentifierPart(c) && c !== 45 /* CharacterCodes.minus */)
|
|
1466
|
+
break;
|
|
1467
|
+
pos = (pos + 1) | 0;
|
|
1468
|
+
}
|
|
1469
|
+
const next = pos < end ? chars[pos] | 0 : -1 /* CharacterCodes.EOF */;
|
|
1470
|
+
if (next <= 127 /* CharacterCodes.maxAsciiCharacter */ && next !== 92 /* CharacterCodes.backslash */) {
|
|
1471
|
+
this.pos = pos;
|
|
1472
|
+
this.setValueSlice(start, pos);
|
|
1473
|
+
return true;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
else if (isASCIILetter(ch) || ch === 95 /* CharacterCodes._ */ || ch === 36 /* CharacterCodes.$ */) {
|
|
1452
1478
|
// Fast path for ASCII identifiers, which also hashes the units for interning.
|
|
1453
1479
|
let pos = (this.pos + 1) | 0;
|
|
1454
1480
|
const end = this.end;
|
|
@@ -1472,35 +1498,47 @@ export class Scanner {
|
|
|
1472
1498
|
this.hashEnd = pos;
|
|
1473
1499
|
return true;
|
|
1474
1500
|
}
|
|
1475
|
-
this.pos = (start + prefixLength) | 0;
|
|
1476
1501
|
}
|
|
1502
|
+
this.pos = identifierStart;
|
|
1503
|
+
const languageVariant = variant === 1 /* IdentifierVariant.JSX */ ? 1 /* LanguageVariant.JSX */ : 0 /* LanguageVariant.Standard */;
|
|
1477
1504
|
ch = this.codePoint();
|
|
1478
|
-
if (
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1505
|
+
if (isIdentifierStart(ch)) {
|
|
1506
|
+
do {
|
|
1507
|
+
this.pos = (this.pos + charSize(ch)) | 0;
|
|
1508
|
+
ch = this.codePoint();
|
|
1509
|
+
} while (isIdentifierPart(ch, languageVariant));
|
|
1510
|
+
if (ch === 92 /* CharacterCodes.backslash */)
|
|
1511
|
+
this.setValue(text.substring(start, this.pos) + this.scanIdentifierParts(variant));
|
|
1512
|
+
else
|
|
1513
|
+
this.setValueSlice(start, this.pos);
|
|
1514
|
+
return true;
|
|
1515
|
+
}
|
|
1516
|
+
if (ch === 92 /* CharacterCodes.backslash */) {
|
|
1517
|
+
const escaped = this.scanIdentifierEscape(true, variant);
|
|
1518
|
+
if (escaped >= 0) {
|
|
1519
|
+
const head = text.substring(start, identifierStart) + String.fromCodePoint(escaped);
|
|
1520
|
+
this.setValue(head + this.scanIdentifierParts(variant));
|
|
1521
|
+
return true;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
return false;
|
|
1489
1525
|
}
|
|
1490
1526
|
/** Scans identifier parts including `\u` escapes and returns their cooked text. */
|
|
1491
|
-
scanIdentifierParts() {
|
|
1527
|
+
scanIdentifierParts(variant) {
|
|
1528
|
+
const languageVariant = variant === 1 /* IdentifierVariant.JSX */ ? 1 /* LanguageVariant.JSX */ : 0 /* LanguageVariant.Standard */;
|
|
1492
1529
|
let result = '';
|
|
1493
1530
|
let start = this.pos;
|
|
1494
1531
|
for (;;) {
|
|
1495
1532
|
const ch = this.codePoint();
|
|
1496
|
-
if (isIdentifierPart(ch)) {
|
|
1533
|
+
if (isIdentifierPart(ch, languageVariant)) {
|
|
1497
1534
|
this.pos = (this.pos + charSize(ch)) | 0;
|
|
1498
1535
|
continue;
|
|
1499
1536
|
}
|
|
1500
1537
|
if (ch === 92 /* CharacterCodes.backslash */) {
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
|
|
1538
|
+
const escapeStart = this.pos;
|
|
1539
|
+
const escaped = this.scanIdentifierEscape(false, variant);
|
|
1540
|
+
if (escaped >= 0) {
|
|
1541
|
+
result += this.text.substring(start, escapeStart) + String.fromCodePoint(escaped);
|
|
1504
1542
|
start = this.pos;
|
|
1505
1543
|
continue;
|
|
1506
1544
|
}
|
|
@@ -1509,6 +1547,37 @@ export class Scanner {
|
|
|
1509
1547
|
}
|
|
1510
1548
|
return start === this.pos ? result : result + this.text.substring(start, this.pos);
|
|
1511
1549
|
}
|
|
1550
|
+
/**
|
|
1551
|
+
* At `\`: scans a `\u` escape of an identifier start (`isStart`) or part and returns its code point,
|
|
1552
|
+
* or returns -1 and leaves the scanner unchanged.
|
|
1553
|
+
*/
|
|
1554
|
+
scanIdentifierEscape(isStart, variant) {
|
|
1555
|
+
const languageVariant = variant === 1 /* IdentifierVariant.JSX */ ? 1 /* LanguageVariant.JSX */ : 0 /* LanguageVariant.Standard */;
|
|
1556
|
+
const escaped = this.peekUnicodeEscape();
|
|
1557
|
+
if (escaped >= 0 && (isStart ? isIdentifierStart(escaped) : isIdentifierPart(escaped, languageVariant)))
|
|
1558
|
+
return this.scanUnicodeEscape(true);
|
|
1559
|
+
// Group names in regular expressions, in Unicode mode or not, take `\u` HexLeadSurrogate `\u`
|
|
1560
|
+
// HexTrailSurrogate as part of RegExpIdentifierName (tc39/ecma262#1869), but not the braced form.
|
|
1561
|
+
if (variant === 2 /* IdentifierVariant.RegExpGroupName */ &&
|
|
1562
|
+
this.peek(2) !== 123 /* CharacterCodes.openBrace */ &&
|
|
1563
|
+
escaped >= 0xd800 &&
|
|
1564
|
+
escaped <= 0xdbff) {
|
|
1565
|
+
const pos = this.pos;
|
|
1566
|
+
const flags = this.tokenFlags;
|
|
1567
|
+
this.scanUnicodeEscape(false);
|
|
1568
|
+
if (this.peek(2) !== 123 /* CharacterCodes.openBrace */) {
|
|
1569
|
+
const low = this.scanLowSurrogateEscape();
|
|
1570
|
+
if (low >= 0) {
|
|
1571
|
+
const codePoint = (escaped - 0xd800) * 0x400 + (low - 0xdc00) + 0x10000;
|
|
1572
|
+
if (isStart ? isIdentifierStart(codePoint) : isIdentifierPart(codePoint, languageVariant))
|
|
1573
|
+
return codePoint;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
this.pos = pos | 0;
|
|
1577
|
+
this.tokenFlags = flags;
|
|
1578
|
+
}
|
|
1579
|
+
return -1;
|
|
1580
|
+
}
|
|
1512
1581
|
scanInvalidCharacter() {
|
|
1513
1582
|
const size = charSize(this.codePoint());
|
|
1514
1583
|
this.errorAt(94 /* Diagnostics.Invalid_character */, this.pos, size, noArgs);
|
|
@@ -1674,9 +1743,9 @@ export class Scanner {
|
|
|
1674
1743
|
if ((flags & 4 /* EscapeSequenceScanningFlags.RegularExpression */) !== 0 &&
|
|
1675
1744
|
(flags & 32 /* EscapeSequenceScanningFlags.AtomEscape */) === 0 &&
|
|
1676
1745
|
ch !== 48 /* CharacterCodes._0 */)
|
|
1677
|
-
this.errorAt(
|
|
1746
|
+
this.errorAt(449 /* Diagnostics.Octal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class_If_this_was_intended_as_an_escape_sequence_use_the_syntax_0_instead */, start, this.pos - start, args);
|
|
1678
1747
|
else
|
|
1679
|
-
this.errorAt(
|
|
1748
|
+
this.errorAt(400 /* Diagnostics.Octal_escape_sequences_are_not_allowed_Use_the_syntax_0 */, start, this.pos - start, args);
|
|
1680
1749
|
return code;
|
|
1681
1750
|
}
|
|
1682
1751
|
return -2 /* EscapeValue.Raw */;
|
|
@@ -1687,9 +1756,9 @@ export class Scanner {
|
|
|
1687
1756
|
if ((flags & 6 /* EscapeSequenceScanningFlags.ReportInvalidEscapeErrors */) !== 0) {
|
|
1688
1757
|
if ((flags & 4 /* EscapeSequenceScanningFlags.RegularExpression */) !== 0 &&
|
|
1689
1758
|
(flags & 32 /* EscapeSequenceScanningFlags.AtomEscape */) === 0)
|
|
1690
|
-
this.errorAt(
|
|
1759
|
+
this.errorAt(450 /* Diagnostics.Decimal_escape_sequences_and_backreferences_are_not_allowed_in_a_character_class */, start, this.pos - start, noArgs);
|
|
1691
1760
|
else
|
|
1692
|
-
this.errorAt(
|
|
1761
|
+
this.errorAt(401 /* Diagnostics.Escape_sequence_0_is_not_allowed */, start, this.pos - start, [
|
|
1693
1762
|
this.text.substring(start, this.pos),
|
|
1694
1763
|
]);
|
|
1695
1764
|
return ch;
|
|
@@ -1720,7 +1789,7 @@ export class Scanner {
|
|
|
1720
1789
|
if (extended && (flags & 17 /* EscapeSequenceScanningFlags.AllowExtendedUnicodeEscape */) === 0) {
|
|
1721
1790
|
this.tokenFlags |= 2048 /* TokenFlags.ContainsInvalidEscape */;
|
|
1722
1791
|
if (reportErrors)
|
|
1723
|
-
this.errorAt(
|
|
1792
|
+
this.errorAt(451 /* Diagnostics.Unicode_escape_sequences_are_only_available_when_the_Unicode_u_flag_or_the_Unicode_Sets_v_flag_is_set */, start, this.pos - start, noArgs);
|
|
1724
1793
|
}
|
|
1725
1794
|
if (codePoint < 0)
|
|
1726
1795
|
return -2 /* EscapeValue.Raw */;
|
|
@@ -1780,7 +1849,7 @@ export class Scanner {
|
|
|
1780
1849
|
((flags & 4 /* EscapeSequenceScanningFlags.RegularExpression */) !== 0 &&
|
|
1781
1850
|
(flags & 8 /* EscapeSequenceScanningFlags.AnnexB */) === 0 &&
|
|
1782
1851
|
isIdentifierPart(ch)))
|
|
1783
|
-
this.errorAt(
|
|
1852
|
+
this.errorAt(448 /* Diagnostics.This_character_cannot_be_escaped_in_a_regular_expression */, start, this.pos - start, noArgs);
|
|
1784
1853
|
return ch;
|
|
1785
1854
|
}
|
|
1786
1855
|
}
|
|
@@ -1898,7 +1967,7 @@ export class Scanner {
|
|
|
1898
1967
|
this.pos = (this.pos + 1) | 0;
|
|
1899
1968
|
if (this.char() === 95 /* CharacterCodes._ */) {
|
|
1900
1969
|
this.tokenFlags |= 512 /* TokenFlags.ContainsSeparator */ | 16384 /* TokenFlags.ContainsInvalidSeparator */;
|
|
1901
|
-
this.errorAt(
|
|
1970
|
+
this.errorAt(1353 /* Diagnostics.Numeric_separators_are_not_allowed_here */, this.pos, 1, noArgs);
|
|
1902
1971
|
this.pos = start | 0;
|
|
1903
1972
|
this.scanNumberFragment();
|
|
1904
1973
|
}
|
|
@@ -1956,7 +2025,7 @@ export class Scanner {
|
|
|
1956
2025
|
}
|
|
1957
2026
|
const raw = this.withoutSeparators(start, end);
|
|
1958
2027
|
if ((this.tokenFlags & 8192 /* TokenFlags.ContainsLeadingZero */) !== 0) {
|
|
1959
|
-
this.errorAt(
|
|
2028
|
+
this.errorAt(402 /* Diagnostics.Decimals_with_leading_zeros_are_not_allowed */, start, this.pos - start, noArgs);
|
|
1960
2029
|
this.setValue(String(Number(raw)));
|
|
1961
2030
|
return 8 /* SyntaxKind.NumericLiteral */;
|
|
1962
2031
|
}
|
|
@@ -1971,7 +2040,7 @@ export class Scanner {
|
|
|
1971
2040
|
}
|
|
1972
2041
|
if (isIdentifierStart(this.codePoint())) {
|
|
1973
2042
|
const idStart = this.pos;
|
|
1974
|
-
const id = this.scanIdentifierParts();
|
|
2043
|
+
const id = this.scanIdentifierParts(0 /* IdentifierVariant.Standard */);
|
|
1975
2044
|
if (result !== 9 /* SyntaxKind.BigIntLiteral */ && id.length === 1 && this.chars[idStart] === 110 /* CharacterCodes.n */) {
|
|
1976
2045
|
if ((this.tokenFlags & 16 /* TokenFlags.Scientific */) !== 0) {
|
|
1977
2046
|
this.errorAt(286 /* Diagnostics.A_bigint_literal_cannot_use_exponential_notation */, start, this.pos - start, noArgs);
|
|
@@ -2008,9 +2077,9 @@ export class Scanner {
|
|
|
2008
2077
|
else {
|
|
2009
2078
|
this.tokenFlags |= 16384 /* TokenFlags.ContainsInvalidSeparator */;
|
|
2010
2079
|
if (isPreviousTokenSeparator)
|
|
2011
|
-
this.errorAt(
|
|
2080
|
+
this.errorAt(1354 /* Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted */, this.pos, 1, noArgs);
|
|
2012
2081
|
else
|
|
2013
|
-
this.errorAt(
|
|
2082
|
+
this.errorAt(1353 /* Diagnostics.Numeric_separators_are_not_allowed_here */, this.pos, 1, noArgs);
|
|
2014
2083
|
}
|
|
2015
2084
|
}
|
|
2016
2085
|
else {
|
|
@@ -2020,7 +2089,7 @@ export class Scanner {
|
|
|
2020
2089
|
}
|
|
2021
2090
|
if (isPreviousTokenSeparator) {
|
|
2022
2091
|
this.tokenFlags |= 16384 /* TokenFlags.ContainsInvalidSeparator */;
|
|
2023
|
-
this.errorAt(
|
|
2092
|
+
this.errorAt(1353 /* Diagnostics.Numeric_separators_are_not_allowed_here */, this.pos - 1, 1, noArgs);
|
|
2024
2093
|
}
|
|
2025
2094
|
return count;
|
|
2026
2095
|
}
|
|
@@ -2043,10 +2112,10 @@ export class Scanner {
|
|
|
2043
2112
|
isPreviousTokenSeparator = true;
|
|
2044
2113
|
}
|
|
2045
2114
|
else if (isPreviousTokenSeparator) {
|
|
2046
|
-
this.errorAt(
|
|
2115
|
+
this.errorAt(1354 /* Diagnostics.Multiple_consecutive_numeric_separators_are_not_permitted */, this.pos, 1, noArgs);
|
|
2047
2116
|
}
|
|
2048
2117
|
else {
|
|
2049
|
-
this.errorAt(
|
|
2118
|
+
this.errorAt(1353 /* Diagnostics.Numeric_separators_are_not_allowed_here */, this.pos, 1, noArgs);
|
|
2050
2119
|
}
|
|
2051
2120
|
}
|
|
2052
2121
|
else {
|
|
@@ -2055,7 +2124,7 @@ export class Scanner {
|
|
|
2055
2124
|
this.pos = (this.pos + 1) | 0;
|
|
2056
2125
|
}
|
|
2057
2126
|
if (isPreviousTokenSeparator)
|
|
2058
|
-
this.errorAt(
|
|
2127
|
+
this.errorAt(1353 /* Diagnostics.Numeric_separators_are_not_allowed_here */, this.pos - 1, 1, noArgs);
|
|
2059
2128
|
return count;
|
|
2060
2129
|
}
|
|
2061
2130
|
scanHexNumber() {
|
|
@@ -2257,11 +2326,11 @@ export class Scanner {
|
|
|
2257
2326
|
if (reportErrors) {
|
|
2258
2327
|
const flag = regularExpressionFlag(ch);
|
|
2259
2328
|
if (flag === 0 /* RegularExpressionFlags.None */)
|
|
2260
|
-
this.errorAt(
|
|
2329
|
+
this.errorAt(412 /* Diagnostics.Unknown_regular_expression_flag */, p, size, noArgs);
|
|
2261
2330
|
else if ((flags & flag) !== 0)
|
|
2262
|
-
this.errorAt(
|
|
2331
|
+
this.errorAt(413 /* Diagnostics.Duplicate_regular_expression_flag */, p, size, noArgs);
|
|
2263
2332
|
else if (((flags | flag) & 96 /* RegularExpressionFlags.AnyUnicodeMode */) === 96 /* RegularExpressionFlags.AnyUnicodeMode */)
|
|
2264
|
-
this.errorAt(
|
|
2333
|
+
this.errorAt(415 /* Diagnostics.The_Unicode_u_flag_and_the_Unicode_Sets_v_flag_cannot_be_set_simultaneously */, p, size, noArgs);
|
|
2265
2334
|
else {
|
|
2266
2335
|
flags |= flag;
|
|
2267
2336
|
this.checkRegularExpressionFlagAvailability(flag, p, size);
|
|
@@ -2297,7 +2366,7 @@ export class Scanner {
|
|
|
2297
2366
|
else
|
|
2298
2367
|
return;
|
|
2299
2368
|
if (this.languageVersion() < availableFrom)
|
|
2300
|
-
this.errorAt(
|
|
2369
|
+
this.errorAt(414 /* Diagnostics.This_regular_expression_flag_is_only_available_when_targeting_0_or_later */, pos, size, [
|
|
2301
2370
|
regularExpressionFlagName(availableFrom),
|
|
2302
2371
|
]);
|
|
2303
2372
|
}
|
|
@@ -2373,18 +2442,8 @@ export class Scanner {
|
|
|
2373
2442
|
scanJsxIdentifier() {
|
|
2374
2443
|
if (!tokenIsIdentifierOrKeyword(this.token))
|
|
2375
2444
|
return this.token;
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
if (this.char() === 45 /* CharacterCodes.minus */) {
|
|
2379
|
-
value += '-';
|
|
2380
|
-
this.pos = (this.pos + 1) | 0;
|
|
2381
|
-
continue;
|
|
2382
|
-
}
|
|
2383
|
-
const pos = this.pos;
|
|
2384
|
-
value += this.scanIdentifierParts();
|
|
2385
|
-
if (this.pos === pos)
|
|
2386
|
-
break;
|
|
2387
|
-
}
|
|
2445
|
+
// An identifier or keyword is scanned: append a following `-` and the rest of the name.
|
|
2446
|
+
const value = this.getTokenValue() + this.scanIdentifierParts(1 /* IdentifierVariant.JSX */);
|
|
2388
2447
|
this.setValue(value);
|
|
2389
2448
|
return (this.token = getIdentifierToken(value));
|
|
2390
2449
|
}
|
|
@@ -2455,7 +2514,6 @@ export class Scanner {
|
|
|
2455
2514
|
scanJSDocToken() {
|
|
2456
2515
|
this.fullStartPos = this.pos | 0;
|
|
2457
2516
|
this.tokenFlags = 0 /* TokenFlags.None */;
|
|
2458
|
-
const text = this.text;
|
|
2459
2517
|
const chars = this.chars;
|
|
2460
2518
|
if (this.pos >= this.end)
|
|
2461
2519
|
return (this.token = 1 /* SyntaxKind.EndOfFile */);
|
|
@@ -2506,40 +2564,13 @@ export class Scanner {
|
|
|
2506
2564
|
return (this.token = 61 /* SyntaxKind.BacktickToken */);
|
|
2507
2565
|
case 35 /* CharacterCodes.hash */:
|
|
2508
2566
|
return (this.token = 62 /* SyntaxKind.HashToken */);
|
|
2509
|
-
case 92 /* CharacterCodes.backslash */: {
|
|
2510
|
-
this.pos = (this.pos - 1) | 0;
|
|
2511
|
-
const codePoint = this.peekUnicodeEscape();
|
|
2512
|
-
if (codePoint >= 0 && isIdentifierStart(codePoint)) {
|
|
2513
|
-
const head = String.fromCodePoint(this.scanUnicodeEscape(true));
|
|
2514
|
-
this.setValue(head + this.scanIdentifierParts());
|
|
2515
|
-
return (this.token = getIdentifierToken(this.tokenValue));
|
|
2516
|
-
}
|
|
2517
|
-
this.pos = (this.pos + 1) | 0;
|
|
2518
|
-
return (this.token = 0 /* SyntaxKind.Unknown */);
|
|
2519
|
-
}
|
|
2520
2567
|
}
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
last = unit;
|
|
2528
|
-
if (!isASCIIIdentifierPart(unit) && unit !== 45 /* CharacterCodes.minus */)
|
|
2529
|
-
break;
|
|
2530
|
-
this.pos = (this.pos + 1) | 0;
|
|
2531
|
-
continue;
|
|
2532
|
-
}
|
|
2533
|
-
last = this.codePointAt(this.pos, this.end);
|
|
2534
|
-
if (!isIdentifierPart(last) && last !== 45 /* CharacterCodes.minus */)
|
|
2535
|
-
break;
|
|
2536
|
-
this.pos = (this.pos + charSize(last)) | 0;
|
|
2537
|
-
}
|
|
2538
|
-
if (last === 92 /* CharacterCodes.backslash */)
|
|
2539
|
-
this.setValue(text.substring(this.tokenStart, this.pos) + this.scanIdentifierParts());
|
|
2540
|
-
else
|
|
2541
|
-
this.setValueSlice(this.tokenStart, this.pos);
|
|
2542
|
-
return (this.token = this.identifierKind());
|
|
2568
|
+
// JSDoc names take `-`, as JSX names do.
|
|
2569
|
+
this.pos = this.tokenStart;
|
|
2570
|
+
if (this.scanIdentifier(0, 1 /* IdentifierVariant.JSX */))
|
|
2571
|
+
return (this.token = this.identifierKind());
|
|
2572
|
+
this.pos = (this.tokenStart + charSize(ch)) | 0;
|
|
2573
|
+
return (this.token = 0 /* SyntaxKind.Unknown */);
|
|
2543
2574
|
}
|
|
2544
2575
|
}
|
|
2545
2576
|
const mergeConflictMarkerLength = 7;
|