tsc-ts 0.0.5 → 0.0.7
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/dist/api/compiler/ast.d.ts +67 -27
- package/dist/api/compiler/ast.js +156 -55
- package/dist/api/compiler/binder-utilities.js +4 -3
- package/dist/api/compiler/binder.js +14 -13
- package/dist/api/compiler/checker-calls.js +7 -6
- package/dist/api/compiler/checker-contextual.js +1 -1
- package/dist/api/compiler/checker-declaration-order.js +2 -1
- package/dist/api/compiler/checker-declarations.js +14 -14
- package/dist/api/compiler/checker-declared-types.d.ts +1 -1
- package/dist/api/compiler/checker-declared-types.js +12 -11
- package/dist/api/compiler/checker-decorators.js +3 -3
- package/dist/api/compiler/checker-deprecation.js +17 -18
- package/dist/api/compiler/checker-destructuring.d.ts +1 -1
- package/dist/api/compiler/checker-destructuring.js +3 -3
- package/dist/api/compiler/checker-elaboration.js +8 -7
- package/dist/api/compiler/checker-emit-helpers.d.ts +2 -1
- package/dist/api/compiler/checker-emit-helpers.js +5 -4
- package/dist/api/compiler/checker-emit-resolver.d.ts +1 -1
- package/dist/api/compiler/checker-emit-resolver.js +5 -4
- package/dist/api/compiler/checker-grammar.js +23 -9
- package/dist/api/compiler/checker-heritage.d.ts +1 -1
- package/dist/api/compiler/checker-heritage.js +14 -13
- package/dist/api/compiler/checker-inference.d.ts +21 -11
- package/dist/api/compiler/checker-inference.js +57 -34
- package/dist/api/compiler/checker-javascript.d.ts +1 -1
- package/dist/api/compiler/checker-javascript.js +5 -4
- package/dist/api/compiler/checker-jsx.d.ts +1 -1
- package/dist/api/compiler/checker-jsx.js +4 -4
- package/dist/api/compiler/checker-literals.js +2 -2
- package/dist/api/compiler/checker-members.d.ts +32 -3
- package/dist/api/compiler/checker-members.js +240 -53
- package/dist/api/compiler/checker-modules.d.ts +15 -1
- package/dist/api/compiler/checker-modules.js +86 -14
- package/dist/api/compiler/checker-object-literals.d.ts +1 -1
- package/dist/api/compiler/checker-object-literals.js +11 -7
- package/dist/api/compiler/checker-overloads.d.ts +1 -1
- package/dist/api/compiler/checker-overloads.js +4 -3
- package/dist/api/compiler/checker-property-access.d.ts +1 -1
- package/dist/api/compiler/checker-property-access.js +2 -2
- package/dist/api/compiler/checker-services.js +2 -2
- package/dist/api/compiler/checker-signatures.d.ts +1 -1
- package/dist/api/compiler/checker-signatures.js +9 -8
- package/dist/api/compiler/checker-symbol-types.d.ts +2 -18
- package/dist/api/compiler/checker-symbol-types.js +22 -952
- package/dist/api/compiler/checker-symbols.d.ts +2 -2
- package/dist/api/compiler/checker-symbols.js +29 -27
- package/dist/api/compiler/checker-type-factory.d.ts +2 -2
- package/dist/api/compiler/checker-type-factory.js +57 -16
- package/dist/api/compiler/checker-type-nodes.d.ts +1 -1
- package/dist/api/compiler/checker-type-nodes.js +2 -2
- package/dist/api/compiler/checker-type-operators.d.ts +1 -1
- package/dist/api/compiler/checker-type-operators.js +5 -5
- package/dist/api/compiler/checker-types.d.ts +73 -7
- package/dist/api/compiler/checker-types.js +220 -43
- package/dist/api/compiler/checker-unused.d.ts +1 -1
- package/dist/api/compiler/checker-unused.js +3 -3
- package/dist/api/compiler/checker.d.ts +45 -8
- package/dist/api/compiler/checker.js +46 -9
- package/dist/api/compiler/diagnostics.d.ts +2 -8
- package/dist/api/compiler/diagnostics.js +13 -45
- package/dist/api/compiler/file-include.d.ts +35 -8
- package/dist/api/compiler/file-include.js +81 -18
- package/dist/api/compiler/file-loader.d.ts +33 -4
- package/dist/api/compiler/file-loader.js +90 -24
- package/dist/api/compiler/instantiation.d.ts +1 -1
- package/dist/api/compiler/instantiation.js +86 -50
- package/dist/api/compiler/link-tables.d.ts +69 -0
- package/dist/api/compiler/link-tables.js +236 -0
- package/dist/api/compiler/name-resolver.js +3 -3
- package/dist/api/compiler/node-builder-names.d.ts +1 -1
- package/dist/api/compiler/node-builder-names.js +12 -12
- package/dist/api/compiler/node-builder-pseudo.d.ts +1 -1
- package/dist/api/compiler/node-builder-pseudo.js +2 -1
- package/dist/api/compiler/node-builder.d.ts +1 -1
- package/dist/api/compiler/node-builder.js +16 -16
- package/dist/api/compiler/parallel-parse.d.ts +2 -0
- package/dist/api/compiler/parallel-parse.js +7 -1
- package/dist/api/compiler/parser.d.ts +33 -16
- package/dist/api/compiler/parser.js +127 -98
- package/dist/api/compiler/printer/emit-context.d.ts +5 -2
- package/dist/api/compiler/printer/emit-context.js +19 -13
- package/dist/api/compiler/printer/factory-base.js +8 -8
- package/dist/api/compiler/printer/factory.js +4 -4
- package/dist/api/compiler/printer/printer.js +6 -6
- package/dist/api/compiler/program-checker.d.ts +5 -0
- package/dist/api/compiler/program-checker.js +14 -1
- package/dist/api/compiler/program.js +9 -1
- package/dist/api/compiler/relations.d.ts +1 -1
- package/dist/api/compiler/relations.js +18 -13
- package/dist/api/compiler/reparser.js +13 -5
- package/dist/api/compiler/symbol-accessibility.d.ts +1 -1
- package/dist/api/compiler/symbol-accessibility.js +123 -26
- package/dist/api/compiler/symbol.d.ts +45 -3
- package/dist/api/compiler/symbol.js +121 -10
- package/dist/api/compiler/transformers/alias-references.d.ts +1 -1
- package/dist/api/compiler/transformers/alias-references.js +2 -1
- package/dist/api/compiler/transformers/class-fields.js +3 -3
- package/dist/api/compiler/transformers/commonjs-module.js +3 -3
- package/dist/api/compiler/transformers/declarations-diagnostics.js +2 -1
- package/dist/api/compiler/transformers/declarations-pseudo.js +6 -4
- package/dist/api/compiler/transformers/declarations-syntactic.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-syntactic.js +9 -9
- package/dist/api/compiler/transformers/declarations-tracker.d.ts +1 -1
- package/dist/api/compiler/transformers/declarations-tracker.js +3 -2
- package/dist/api/compiler/transformers/declarations.js +6 -5
- package/dist/api/compiler/transformers/module.js +2 -2
- package/dist/api/compiler/transformers/optional-chain.js +3 -3
- package/dist/api/compiler/transformers/reference-resolver.d.ts +2 -1
- package/dist/api/compiler/transformers/reference-resolver.js +26 -24
- package/dist/api/compiler/transformers/subtree-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/subtree-facts.js +9 -7
- package/dist/api/compiler/transformers/syntax-facts.d.ts +1 -0
- package/dist/api/compiler/transformers/syntax-facts.js +9 -5
- package/dist/api/compiler/transformers/tagged-template.js +2 -2
- package/dist/api/compiler/transformers/type-eraser.js +2 -2
- package/dist/api/compiler/transformers/type-serialization.js +12 -12
- package/dist/api/compiler/transformers/visitor-base.js +3 -3
- package/dist/api/compiler/tsconfig.js +2 -2
- package/package.json +9 -9
- package/src/compiler/ast.ts +211 -78
- package/src/compiler/binder-utilities.ts +4 -3
- package/src/compiler/binder.ts +26 -16
- package/src/compiler/checker-calls.ts +8 -6
- package/src/compiler/checker-contextual.ts +1 -1
- package/src/compiler/checker-declaration-order.ts +2 -2
- package/src/compiler/checker-declarations.ts +21 -14
- package/src/compiler/checker-declared-types.ts +12 -12
- package/src/compiler/checker-decorators.ts +3 -3
- package/src/compiler/checker-deprecation.ts +17 -21
- package/src/compiler/checker-destructuring.ts +3 -3
- package/src/compiler/checker-elaboration.ts +8 -8
- package/src/compiler/checker-emit-helpers.ts +5 -4
- package/src/compiler/checker-emit-resolver.ts +5 -5
- package/src/compiler/checker-grammar.ts +22 -8
- package/src/compiler/checker-heritage.ts +21 -14
- package/src/compiler/checker-inference.ts +66 -34
- package/src/compiler/checker-javascript.ts +5 -5
- package/src/compiler/checker-jsx.ts +12 -8
- package/src/compiler/checker-literals.ts +2 -2
- package/src/compiler/checker-members.ts +255 -47
- package/src/compiler/checker-modules.ts +115 -14
- package/src/compiler/checker-object-literals.ts +22 -6
- package/src/compiler/checker-overloads.ts +6 -6
- package/src/compiler/checker-property-access.ts +2 -2
- package/src/compiler/checker-services.ts +2 -2
- package/src/compiler/checker-signatures.ts +9 -9
- package/src/compiler/checker-symbol-types.ts +20 -940
- package/src/compiler/checker-symbols.ts +42 -35
- package/src/compiler/checker-type-factory.ts +53 -16
- package/src/compiler/checker-type-nodes.ts +2 -2
- package/src/compiler/checker-type-operators.ts +13 -5
- package/src/compiler/checker-types.ts +223 -43
- package/src/compiler/checker-unused.ts +3 -3
- package/src/compiler/checker.ts +50 -9
- package/src/compiler/decoder.ts +5 -4
- package/src/compiler/diagnostics.ts +14 -48
- package/src/compiler/encoder.ts +10 -5
- package/src/compiler/file-include.ts +85 -17
- package/src/compiler/file-loader.ts +104 -35
- package/src/compiler/incremental.ts +39 -5
- package/src/compiler/instantiation.ts +99 -55
- package/src/compiler/link-tables.ts +245 -0
- package/src/compiler/name-resolver.ts +3 -3
- package/src/compiler/node-builder-names.ts +21 -19
- package/src/compiler/node-builder-pseudo.ts +2 -2
- package/src/compiler/node-builder.ts +24 -16
- package/src/compiler/parallel-check.ts +11 -8
- package/src/compiler/parallel-parse.ts +8 -1
- package/src/compiler/parse-thread.ts +0 -4
- package/src/compiler/parser.ts +173 -93
- package/src/compiler/printer/emit-context.ts +20 -15
- package/src/compiler/printer/factory-base.ts +14 -7
- package/src/compiler/printer/factory.ts +5 -3
- package/src/compiler/printer/printer.ts +8 -6
- package/src/compiler/program-checker.ts +12 -1
- package/src/compiler/program.ts +8 -1
- package/src/compiler/relations.ts +20 -12
- package/src/compiler/reparser.ts +14 -4
- package/src/compiler/symbol-accessibility.ts +120 -25
- package/src/compiler/symbol.ts +127 -9
- package/src/compiler/transformers/alias-references.ts +2 -2
- package/src/compiler/transformers/class-fields.ts +12 -2
- package/src/compiler/transformers/commonjs-module.ts +3 -2
- package/src/compiler/transformers/declarations-diagnostics.ts +2 -1
- package/src/compiler/transformers/declarations-pseudo.ts +9 -5
- package/src/compiler/transformers/declarations-syntactic.ts +17 -9
- package/src/compiler/transformers/declarations-tracker.ts +3 -3
- package/src/compiler/transformers/declarations.ts +7 -7
- package/src/compiler/transformers/module.ts +2 -1
- package/src/compiler/transformers/optional-chain.ts +5 -2
- package/src/compiler/transformers/reference-resolver.ts +37 -25
- package/src/compiler/transformers/subtree-facts.ts +15 -6
- package/src/compiler/transformers/syntax-facts.ts +10 -5
- package/src/compiler/transformers/tagged-template.ts +2 -2
- package/src/compiler/transformers/type-eraser.ts +2 -1
- package/src/compiler/transformers/type-serialization.ts +12 -12
- package/src/compiler/transformers/visitor-base.ts +10 -5
- package/src/compiler/tsc-build.ts +17 -13
- package/src/compiler/tsc-cli.ts +9 -6
- package/src/compiler/tsc-compile.ts +16 -7
- package/src/compiler/tsc-watch.ts +94 -26
- package/src/compiler/tsconfig.ts +2 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Generated by scripts/generate-visitor.mjs; do not edit.
|
|
2
|
-
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocDeprecatedTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverloadTag, JSDocOverrideTag, JSDocParameterOrPropertyTag, JSDocPrivateTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSatisfiesTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, JSDocTypeExpression, JSDocTypeTag, JSDocTypedefTag, JSDocUnknownTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, SwitchStatement, SyntheticReferenceExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, Token, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, } from '../ast.js';
|
|
2
|
+
import { ArrayLiteralExpression, ArrayTypeNode, ArrowFunction, AsExpression, AwaitExpression, BinaryExpression, BindingElement, BindingPattern, Block, BreakStatement, CallExpression, CallSignatureDeclaration, CaseBlock, CaseOrDefaultClause, CatchClause, ClassDeclaration, ClassExpression, ClassStaticBlockDeclaration, ComputedPropertyName, ConditionalExpression, ConditionalTypeNode, ConstructSignatureDeclaration, ConstructorDeclaration, ConstructorTypeNode, ContinueStatement, Decorator, DeleteExpression, DoStatement, ElementAccessExpression, EnumDeclaration, EnumMember, ExportAssignment, ExportDeclaration, ExportSpecifier, ExpressionStatement, ExpressionWithTypeArguments, ExternalModuleReference, ForInOrOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, FunctionTypeNode, GetAccessorDeclaration, HeritageClause, Identifier, IfStatement, ImportAttribute, ImportAttributes, ImportClause, ImportDeclaration, ImportEqualsDeclaration, ImportSpecifier, ImportTypeNode, IndexSignatureDeclaration, IndexedAccessTypeNode, InferTypeNode, InterfaceDeclaration, IntersectionTypeNode, JSDoc, JSDocAugmentsTag, JSDocCallbackTag, JSDocDeprecatedTag, JSDocImplementsTag, JSDocImportTag, JSDocLink, JSDocLinkCode, JSDocLinkPlain, JSDocNameReference, JSDocNonNullableType, JSDocNullableType, JSDocOptionalType, JSDocOverloadTag, JSDocOverrideTag, JSDocParameterOrPropertyTag, JSDocPrivateTag, JSDocProtectedTag, JSDocPublicTag, JSDocReadonlyTag, JSDocReturnTag, JSDocSatisfiesTag, JSDocSeeTag, JSDocSignature, JSDocTemplateTag, JSDocThisTag, JSDocThrowsTag, JSDocTypeExpression, JSDocTypeTag, JSDocTypedefTag, JSDocUnknownTag, JSDocVariadicType, JsxAttribute, JsxAttributes, JsxClosingElement, JsxClosingFragment, JsxElement, JsxExpression, JsxFragment, JsxNamespacedName, JsxOpeningElement, JsxOpeningFragment, JsxSelfClosingElement, JsxSpreadAttribute, LabeledStatement, LiteralTypeNode, MappedTypeNode, MetaProperty, MethodDeclaration, MethodSignatureDeclaration, MissingDeclaration, ModuleBlock, ModuleDeclaration, NamedExports, NamedImports, NamedTupleMember, NamespaceExport, NamespaceExportDeclaration, NamespaceImport, NewExpression, NonNullExpression, ObjectLiteralExpression, OptionalTypeNode, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, PartiallyEmittedExpression, PostfixUnaryExpression, PrefixUnaryExpression, PropertyAccessExpression, PropertyAssignment, PropertyDeclaration, PropertySignatureDeclaration, QualifiedName, RestTypeNode, ReturnStatement, SatisfiesExpression, SetAccessorDeclaration, ShorthandPropertyAssignment, SourceFile, SpreadAssignment, SpreadElement, SwitchStatement, SyntheticReferenceExpression, TaggedTemplateExpression, TemplateExpression, TemplateHead, TemplateLiteralTypeNode, TemplateLiteralTypeSpan, TemplateSpan, ThrowStatement, Token, TryStatement, TupleTypeNode, TypeAliasDeclaration, TypeAssertion, TypeLiteralNode, TypeOfExpression, TypeOperatorNode, TypeParameterDeclaration, TypePredicateNode, TypeQueryNode, TypeReferenceNode, UnionTypeNode, VariableDeclaration, VariableDeclarationList, VariableStatement, VoidExpression, WhileStatement, WithStatement, YieldExpression, propertyAssignmentPostfixToken, propertyAssignmentType, callQuestionDotToken, propertyAssignmentModifiers, callTypeArguments, } from '../ast.js';
|
|
3
3
|
import { VisitorHooks } from './visitor-hooks.js';
|
|
4
4
|
// A removed required child keeps the original, as tsgo's nil child is never printed.
|
|
5
5
|
function required(node, original) {
|
|
@@ -192,7 +192,7 @@ export class VisitorBase extends VisitorHooks {
|
|
|
192
192
|
break;
|
|
193
193
|
case 214 /* SyntaxKind.CallExpression */:
|
|
194
194
|
if (node instanceof CallExpression)
|
|
195
|
-
return this.factory.updateCallExpression(node, required(this.visitNode(node.expression), node.expression), asOptionalToken(this.visitNode(node
|
|
195
|
+
return this.factory.updateCallExpression(node, required(this.visitNode(node.expression), node.expression), asOptionalToken(this.visitNode(callQuestionDotToken(node))), this.visitNodes(callTypeArguments(node)), this.visitNodes(node.arguments), node.flags);
|
|
196
196
|
break;
|
|
197
197
|
case 180 /* SyntaxKind.CallSignature */:
|
|
198
198
|
if (node instanceof CallSignatureDeclaration)
|
|
@@ -656,7 +656,7 @@ export class VisitorBase extends VisitorHooks {
|
|
|
656
656
|
break;
|
|
657
657
|
case 303 /* SyntaxKind.PropertyAssignment */:
|
|
658
658
|
if (node instanceof PropertyAssignment)
|
|
659
|
-
return this.factory.updatePropertyAssignment(node, this.visitModifiers(node
|
|
659
|
+
return this.factory.updatePropertyAssignment(node, this.visitModifiers(propertyAssignmentModifiers(node)), required(this.visitNode(node.name), node.name), asOptionalToken(this.visitNode(propertyAssignmentPostfixToken(node))), this.visitNode(propertyAssignmentType(node)), required(this.visitNode(node.initializer), node.initializer));
|
|
660
660
|
break;
|
|
661
661
|
case 173 /* SyntaxKind.PropertyDeclaration */:
|
|
662
662
|
if (node instanceof PropertyDeclaration)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* const config = new ConfigParser(fs, '/app').parseConfigFile('/app/tsconfig.json', {}, undefined, errors);
|
|
7
7
|
* ```
|
|
8
8
|
*/
|
|
9
|
-
import { ArrayLiteralExpression, ComputedPropertyName, ExpressionStatement, ExternalModuleIndicatorOptions, getText, Identifier, NumericLiteral, ObjectLiteralExpression, ParseOptions, PrefixUnaryExpression, PropertyAssignment, StringLiteral, } from './ast.js';
|
|
9
|
+
import { ArrayLiteralExpression, ComputedPropertyName, ExpressionStatement, ExternalModuleIndicatorOptions, getText, Identifier, NumericLiteral, ObjectLiteralExpression, ParseOptions, PrefixUnaryExpression, PropertyAssignment, StringLiteral, propertyAssignmentPostfixToken, } from './ast.js';
|
|
10
10
|
import { enumNamesList } from './command-line.js';
|
|
11
11
|
import { compareCodePoints, createCompilerDiagnostic, Diagnostic, } from './diagnostics.js';
|
|
12
12
|
import { isValidLocale } from './locale.js';
|
|
@@ -767,7 +767,7 @@ class ConfigFileConverter {
|
|
|
767
767
|
this.errors.push(diagnosticAtRange(this.file, element, 102 /* Diagnostics.Property_assignment_expected */));
|
|
768
768
|
continue;
|
|
769
769
|
}
|
|
770
|
-
const postfix = element
|
|
770
|
+
const postfix = propertyAssignmentPostfixToken(element);
|
|
771
771
|
if (postfix !== undefined && postfix.kind === 57 /* SyntaxKind.QuestionToken */) {
|
|
772
772
|
this.errors.push(diagnosticAtRange(this.file, postfix, 1741 /* Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files */, '?'));
|
|
773
773
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tsc-ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
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.
|
|
32
|
+
"@scriptc/threads": "0.4.1"
|
|
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.0.7",
|
|
39
|
+
"@tsc-ts/darwin-x64": "0.0.7",
|
|
40
|
+
"@tsc-ts/linux-arm64-gnu": "0.0.7",
|
|
41
|
+
"@tsc-ts/linux-arm64-musl": "0.0.7",
|
|
42
|
+
"@tsc-ts/linux-x64-gnu": "0.0.7",
|
|
43
|
+
"@tsc-ts/linux-x64-musl": "0.0.7",
|
|
44
|
+
"@tsc-ts/win32-x64-msvc": "0.0.7"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/compiler/ast.ts
CHANGED
|
@@ -450,13 +450,10 @@ export class Token extends Node {
|
|
|
450
450
|
|
|
451
451
|
export class Identifier extends Node {
|
|
452
452
|
text: string;
|
|
453
|
-
// Set by the binder.
|
|
454
|
-
flowNode: FlowNode | undefined;
|
|
455
453
|
|
|
456
454
|
constructor(text: string) {
|
|
457
455
|
super(SyntaxKind.Identifier);
|
|
458
456
|
this.text = text;
|
|
459
|
-
this.flowNode = undefined;
|
|
460
457
|
}
|
|
461
458
|
|
|
462
459
|
forEachChild(_v: NodeVisitor): boolean {
|
|
@@ -478,6 +475,29 @@ export class Identifier extends Node {
|
|
|
478
475
|
}
|
|
479
476
|
}
|
|
480
477
|
|
|
478
|
+
/**
|
|
479
|
+
* An identifier that can be read as a reference, such as an expression or a shorthand property
|
|
480
|
+
* name, and so holds the binder's flow node. The parser creates a plain `Identifier` for names
|
|
481
|
+
* whose flow node nothing reads: declaration names, property names and property access names.
|
|
482
|
+
*/
|
|
483
|
+
export class ReferenceIdentifier extends Identifier {
|
|
484
|
+
// Set by the binder.
|
|
485
|
+
flowNode: FlowNode | undefined;
|
|
486
|
+
|
|
487
|
+
constructor(text: string) {
|
|
488
|
+
super(text);
|
|
489
|
+
this.flowNode = undefined;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
copy(): Identifier {
|
|
493
|
+
const node = new ReferenceIdentifier(this.text);
|
|
494
|
+
node.flags = this.flags;
|
|
495
|
+
node.pos = this.pos;
|
|
496
|
+
node.end = this.end;
|
|
497
|
+
return node;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
|
|
481
501
|
export class PrivateIdentifier extends Node {
|
|
482
502
|
text: string;
|
|
483
503
|
|
|
@@ -4055,9 +4075,45 @@ export class ElementAccessExpression extends Node {
|
|
|
4055
4075
|
|
|
4056
4076
|
export class CallExpression extends Node {
|
|
4057
4077
|
expression: Expression;
|
|
4078
|
+
arguments: NodeList;
|
|
4079
|
+
|
|
4080
|
+
constructor(expression: Expression, args: NodeList, flags: NodeFlags) {
|
|
4081
|
+
super(SyntaxKind.CallExpression);
|
|
4082
|
+
this.expression = expression;
|
|
4083
|
+
this.arguments = args;
|
|
4084
|
+
this.flags |= flags & NodeFlags.OptionalChain;
|
|
4085
|
+
}
|
|
4086
|
+
|
|
4087
|
+
forEachChild(v: NodeVisitor): boolean {
|
|
4088
|
+
if (v.visitNode(this.expression)) return true;
|
|
4089
|
+
return v.visitList(this.arguments);
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
setParentOfChildren(): void {
|
|
4093
|
+
this.expression.parent = this;
|
|
4094
|
+
setParents(this.arguments.nodes, this);
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
deepClone(): Node {
|
|
4098
|
+
return this.copy();
|
|
4099
|
+
}
|
|
4100
|
+
|
|
4101
|
+
copy(): CallExpression {
|
|
4102
|
+
const node = new CallExpression(this.expression.deepClone(), cloneList(this.arguments), this.flags);
|
|
4103
|
+
node.flags = this.flags;
|
|
4104
|
+
node.pos = this.pos;
|
|
4105
|
+
node.end = this.end;
|
|
4106
|
+
return node;
|
|
4107
|
+
}
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4110
|
+
/**
|
|
4111
|
+
* A call with `?.` or type arguments, or in a JavaScript file, where the binder can declare a symbol
|
|
4112
|
+
* for it (`Object.defineProperty`). Other calls are a plain `CallExpression`, without these fields.
|
|
4113
|
+
*/
|
|
4114
|
+
export class FullCallExpression extends CallExpression {
|
|
4058
4115
|
questionDotToken: Token | undefined;
|
|
4059
4116
|
typeArguments: NodeList | undefined;
|
|
4060
|
-
arguments: NodeList;
|
|
4061
4117
|
// Set by the binder.
|
|
4062
4118
|
symbol: Symbol | undefined;
|
|
4063
4119
|
|
|
@@ -4068,12 +4124,9 @@ export class CallExpression extends Node {
|
|
|
4068
4124
|
args: NodeList,
|
|
4069
4125
|
flags: NodeFlags,
|
|
4070
4126
|
) {
|
|
4071
|
-
super(
|
|
4072
|
-
this.expression = expression;
|
|
4127
|
+
super(expression, args, flags);
|
|
4073
4128
|
this.questionDotToken = questionDotToken;
|
|
4074
4129
|
this.typeArguments = typeArguments;
|
|
4075
|
-
this.arguments = args;
|
|
4076
|
-
this.flags |= flags & NodeFlags.OptionalChain;
|
|
4077
4130
|
this.symbol = undefined;
|
|
4078
4131
|
}
|
|
4079
4132
|
|
|
@@ -4091,12 +4144,8 @@ export class CallExpression extends Node {
|
|
|
4091
4144
|
setParents(this.arguments.nodes, this);
|
|
4092
4145
|
}
|
|
4093
4146
|
|
|
4094
|
-
deepClone(): Node {
|
|
4095
|
-
return this.copy();
|
|
4096
|
-
}
|
|
4097
|
-
|
|
4098
4147
|
copy(): CallExpression {
|
|
4099
|
-
const node = new
|
|
4148
|
+
const node = new FullCallExpression(
|
|
4100
4149
|
this.expression.deepClone(),
|
|
4101
4150
|
this.questionDotToken === undefined ? undefined : this.questionDotToken.copy(),
|
|
4102
4151
|
this.typeArguments === undefined ? undefined : cloneList(this.typeArguments),
|
|
@@ -4110,6 +4159,28 @@ export class CallExpression extends Node {
|
|
|
4110
4159
|
}
|
|
4111
4160
|
}
|
|
4112
4161
|
|
|
4162
|
+
/** A `FullCallExpression` when one of its fields is set or `inJavaScript`, else a `CallExpression`. */
|
|
4163
|
+
export function newCallExpression(
|
|
4164
|
+
expression: Expression,
|
|
4165
|
+
questionDotToken: Token | undefined,
|
|
4166
|
+
typeArguments: NodeList | undefined,
|
|
4167
|
+
args: NodeList,
|
|
4168
|
+
flags: NodeFlags,
|
|
4169
|
+
inJavaScript: boolean,
|
|
4170
|
+
): CallExpression {
|
|
4171
|
+
if (inJavaScript || questionDotToken !== undefined || typeArguments !== undefined)
|
|
4172
|
+
return new FullCallExpression(expression, questionDotToken, typeArguments, args, flags);
|
|
4173
|
+
return new CallExpression(expression, args, flags);
|
|
4174
|
+
}
|
|
4175
|
+
|
|
4176
|
+
export function callQuestionDotToken(node: CallExpression): Token | undefined {
|
|
4177
|
+
return node instanceof FullCallExpression ? node.questionDotToken : undefined;
|
|
4178
|
+
}
|
|
4179
|
+
|
|
4180
|
+
export function callTypeArguments(node: CallExpression): NodeList | undefined {
|
|
4181
|
+
return node instanceof FullCallExpression ? node.typeArguments : undefined;
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4113
4184
|
export class NewExpression extends Node {
|
|
4114
4185
|
expression: Expression;
|
|
4115
4186
|
typeArguments: NodeList | undefined;
|
|
@@ -4491,14 +4562,51 @@ export class SpreadAssignment extends Node {
|
|
|
4491
4562
|
}
|
|
4492
4563
|
|
|
4493
4564
|
export class PropertyAssignment extends Node {
|
|
4494
|
-
modifiers: ModifierList | undefined;
|
|
4495
4565
|
name: PropertyName;
|
|
4496
|
-
postfixToken: Token | undefined;
|
|
4497
|
-
type: TypeNode | undefined;
|
|
4498
4566
|
initializer: Expression;
|
|
4499
4567
|
// Set by the binder.
|
|
4500
4568
|
symbol: Symbol | undefined;
|
|
4501
4569
|
|
|
4570
|
+
constructor(name: PropertyName, initializer: Expression) {
|
|
4571
|
+
super(SyntaxKind.PropertyAssignment);
|
|
4572
|
+
this.name = name;
|
|
4573
|
+
this.initializer = initializer;
|
|
4574
|
+
this.symbol = undefined;
|
|
4575
|
+
}
|
|
4576
|
+
|
|
4577
|
+
forEachChild(v: NodeVisitor): boolean {
|
|
4578
|
+
if (v.visitNode(this.name)) return true;
|
|
4579
|
+
return v.visitNode(this.initializer);
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
setParentOfChildren(): void {
|
|
4583
|
+
this.name.parent = this;
|
|
4584
|
+
this.initializer.parent = this;
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4587
|
+
deepClone(): Node {
|
|
4588
|
+
return this.copy();
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
copy(): PropertyAssignment {
|
|
4592
|
+
const node = new PropertyAssignment(this.name.deepClone(), this.initializer.deepClone());
|
|
4593
|
+
node.flags = this.flags;
|
|
4594
|
+
node.pos = this.pos;
|
|
4595
|
+
node.end = this.end;
|
|
4596
|
+
return node;
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4599
|
+
|
|
4600
|
+
/**
|
|
4601
|
+
* A property assignment with modifiers, a `?` or `!`, or a type annotation (which the grammar checker
|
|
4602
|
+
* reports), or in a JavaScript file, where JSDoc can give it a type or modifiers. Other property
|
|
4603
|
+
* assignments are a plain `PropertyAssignment`, without these fields.
|
|
4604
|
+
*/
|
|
4605
|
+
export class FullPropertyAssignment extends PropertyAssignment {
|
|
4606
|
+
modifiers: ModifierList | undefined;
|
|
4607
|
+
postfixToken: Token | undefined;
|
|
4608
|
+
type: TypeNode | undefined;
|
|
4609
|
+
|
|
4502
4610
|
constructor(
|
|
4503
4611
|
modifiers: ModifierList | undefined,
|
|
4504
4612
|
name: PropertyName,
|
|
@@ -4506,13 +4614,10 @@ export class PropertyAssignment extends Node {
|
|
|
4506
4614
|
type: TypeNode | undefined,
|
|
4507
4615
|
initializer: Expression,
|
|
4508
4616
|
) {
|
|
4509
|
-
super(
|
|
4617
|
+
super(name, initializer);
|
|
4510
4618
|
this.modifiers = modifiers;
|
|
4511
|
-
this.name = name;
|
|
4512
4619
|
this.postfixToken = postfixToken;
|
|
4513
4620
|
this.type = type;
|
|
4514
|
-
this.initializer = initializer;
|
|
4515
|
-
this.symbol = undefined;
|
|
4516
4621
|
}
|
|
4517
4622
|
|
|
4518
4623
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -4531,12 +4636,8 @@ export class PropertyAssignment extends Node {
|
|
|
4531
4636
|
this.initializer.parent = this;
|
|
4532
4637
|
}
|
|
4533
4638
|
|
|
4534
|
-
deepClone(): Node {
|
|
4535
|
-
return this.copy();
|
|
4536
|
-
}
|
|
4537
|
-
|
|
4538
4639
|
copy(): PropertyAssignment {
|
|
4539
|
-
const node = new
|
|
4640
|
+
const node = new FullPropertyAssignment(
|
|
4540
4641
|
this.modifiers === undefined ? undefined : cloneModifiers(this.modifiers),
|
|
4541
4642
|
this.name.deepClone(),
|
|
4542
4643
|
this.postfixToken === undefined ? undefined : this.postfixToken.copy(),
|
|
@@ -4550,6 +4651,32 @@ export class PropertyAssignment extends Node {
|
|
|
4550
4651
|
}
|
|
4551
4652
|
}
|
|
4552
4653
|
|
|
4654
|
+
/** A `FullPropertyAssignment` when one of its fields is set or `inJavaScript`, else a `PropertyAssignment`. */
|
|
4655
|
+
export function newPropertyAssignment(
|
|
4656
|
+
modifiers: ModifierList | undefined,
|
|
4657
|
+
name: PropertyName,
|
|
4658
|
+
postfixToken: Token | undefined,
|
|
4659
|
+
type: TypeNode | undefined,
|
|
4660
|
+
initializer: Expression,
|
|
4661
|
+
inJavaScript: boolean,
|
|
4662
|
+
): PropertyAssignment {
|
|
4663
|
+
if (inJavaScript || modifiers !== undefined || postfixToken !== undefined || type !== undefined)
|
|
4664
|
+
return new FullPropertyAssignment(modifiers, name, postfixToken, type, initializer);
|
|
4665
|
+
return new PropertyAssignment(name, initializer);
|
|
4666
|
+
}
|
|
4667
|
+
|
|
4668
|
+
export function propertyAssignmentModifiers(node: PropertyAssignment): ModifierList | undefined {
|
|
4669
|
+
return node instanceof FullPropertyAssignment ? node.modifiers : undefined;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
export function propertyAssignmentPostfixToken(node: PropertyAssignment): Token | undefined {
|
|
4673
|
+
return node instanceof FullPropertyAssignment ? node.postfixToken : undefined;
|
|
4674
|
+
}
|
|
4675
|
+
|
|
4676
|
+
export function propertyAssignmentType(node: PropertyAssignment): TypeNode | undefined {
|
|
4677
|
+
return node instanceof FullPropertyAssignment ? node.type : undefined;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4553
4680
|
export class ShorthandPropertyAssignment extends Node {
|
|
4554
4681
|
modifiers: ModifierList | undefined;
|
|
4555
4682
|
name: PropertyName;
|
|
@@ -8089,6 +8216,24 @@ export class JSDocParameterOrPropertyTag extends Node {
|
|
|
8089
8216
|
}
|
|
8090
8217
|
}
|
|
8091
8218
|
|
|
8219
|
+
// The lists of a source file that has none. Most files have no diagnostics, references, pragmas
|
|
8220
|
+
// or ambient modules, so they share these instead of holding empty arrays of their own. A list
|
|
8221
|
+
// that grows replaces an empty one rather than pushing to it (appendToList).
|
|
8222
|
+
export const emptyDiagnostics: readonly Diagnostic[] = [];
|
|
8223
|
+
export const emptyNodes: readonly Node[] = [];
|
|
8224
|
+
export const emptyStrings: readonly string[] = [];
|
|
8225
|
+
export const emptyCommentDirectives: readonly CommentDirective[] = [];
|
|
8226
|
+
export const emptyPragmas: readonly Pragma[] = [];
|
|
8227
|
+
export const emptyFileReferences: readonly FileReference[] = [];
|
|
8228
|
+
export const emptyPatternAmbientModules: readonly PatternAmbientModule[] = [];
|
|
8229
|
+
|
|
8230
|
+
/** `list` with `item` appended: a new array when `list` is empty (it may be shared), else `list` itself. */
|
|
8231
|
+
export function appendToList<T>(list: readonly T[], item: T): readonly T[] {
|
|
8232
|
+
if (list.length === 0) return [item];
|
|
8233
|
+
(list as T[]).push(item);
|
|
8234
|
+
return list;
|
|
8235
|
+
}
|
|
8236
|
+
|
|
8092
8237
|
export class SourceFile extends Node {
|
|
8093
8238
|
readonly fileName: string;
|
|
8094
8239
|
readonly path: string;
|
|
@@ -8098,10 +8243,10 @@ export class SourceFile extends Node {
|
|
|
8098
8243
|
endOfFileToken: Token;
|
|
8099
8244
|
|
|
8100
8245
|
// Set by the parser.
|
|
8101
|
-
diagnostics: Diagnostic[];
|
|
8246
|
+
diagnostics: readonly Diagnostic[];
|
|
8102
8247
|
/** Diagnostics for TypeScript-only syntax in JavaScript files. */
|
|
8103
|
-
jsDiagnostics: Diagnostic[];
|
|
8104
|
-
jsDocDiagnostics: Diagnostic[];
|
|
8248
|
+
jsDiagnostics: readonly Diagnostic[];
|
|
8249
|
+
jsDocDiagnostics: readonly Diagnostic[];
|
|
8105
8250
|
languageVariant: LanguageVariant;
|
|
8106
8251
|
scriptKind: ScriptKind;
|
|
8107
8252
|
isDeclarationFile: boolean;
|
|
@@ -8116,20 +8261,20 @@ export class SourceFile extends Node {
|
|
|
8116
8261
|
/** Module specifiers of imports, exports, `require` calls and `import()` types, in source order. */
|
|
8117
8262
|
imports: Node[];
|
|
8118
8263
|
/** Names of `declare module "x"` augmentations and `declare global` blocks in modules. */
|
|
8119
|
-
moduleAugmentations: Node[];
|
|
8120
|
-
ambientModuleNames: string[];
|
|
8264
|
+
moduleAugmentations: readonly Node[];
|
|
8265
|
+
ambientModuleNames: readonly string[];
|
|
8121
8266
|
commentDirectives: readonly CommentDirective[];
|
|
8122
|
-
pragmas: Pragma[];
|
|
8123
|
-
referencedFiles: FileReference[];
|
|
8124
|
-
typeReferenceDirectives: FileReference[];
|
|
8125
|
-
libReferenceDirectives: FileReference[];
|
|
8267
|
+
pragmas: readonly Pragma[];
|
|
8268
|
+
referencedFiles: readonly FileReference[];
|
|
8269
|
+
typeReferenceDirectives: readonly FileReference[];
|
|
8270
|
+
libReferenceDirectives: readonly FileReference[];
|
|
8126
8271
|
checkJsDirective: CheckJsDirective | undefined;
|
|
8127
8272
|
/** The first CommonJS `module.exports`/`exports.x` use in a JavaScript file. */
|
|
8128
8273
|
commonJSModuleIndicator: Node | undefined;
|
|
8129
8274
|
/** What makes this file a module: an import or export statement, `import.meta`, a JSX tag, or the file itself when forced. */
|
|
8130
8275
|
externalModuleIndicator: Node | undefined;
|
|
8131
8276
|
/** Nodes cloned by JSDoc reparsing, sorted by position. */
|
|
8132
|
-
reparsedClones: Node[];
|
|
8277
|
+
reparsedClones: readonly Node[];
|
|
8133
8278
|
/** Whether JSDoc of TypeScript files is parsed on first use. */
|
|
8134
8279
|
hasLazyJSDoc: boolean;
|
|
8135
8280
|
/**
|
|
@@ -8144,20 +8289,14 @@ export class SourceFile extends Node {
|
|
|
8144
8289
|
locals: SymbolTable | undefined;
|
|
8145
8290
|
nextContainer: Node | undefined;
|
|
8146
8291
|
isBound: boolean;
|
|
8147
|
-
bindDiagnostics: Diagnostic[];
|
|
8292
|
+
bindDiagnostics: readonly Diagnostic[];
|
|
8148
8293
|
/** The flow at the end of the file. */
|
|
8149
8294
|
endFlowNode: FlowNode | undefined;
|
|
8150
8295
|
symbolCount: number;
|
|
8151
8296
|
/** Ambient modules with a `*` in their name, like `declare module "*.css"`. */
|
|
8152
|
-
patternAmbientModules: PatternAmbientModule[];
|
|
8297
|
+
patternAmbientModules: readonly PatternAmbientModule[];
|
|
8153
8298
|
/** UMD exports from `export as namespace N`. */
|
|
8154
8299
|
globalExports: SymbolTable | undefined;
|
|
8155
|
-
/**
|
|
8156
|
-
* By name, the first property of the unions of the file's object literals that leave the name
|
|
8157
|
-
* missing (checker-symbol-types.ts `scanSiblingProperties`), where a parse thread scanned the file
|
|
8158
|
-
* and could resolve the enums the scan needed.
|
|
8159
|
-
*/
|
|
8160
|
-
siblingProperties: Map<string, Node> | undefined;
|
|
8161
8300
|
|
|
8162
8301
|
constructor(
|
|
8163
8302
|
fileName: string,
|
|
@@ -8174,9 +8313,9 @@ export class SourceFile extends Node {
|
|
|
8174
8313
|
this.externalModuleIndicatorOptions = externalModuleIndicatorOptions;
|
|
8175
8314
|
this.statements = statements;
|
|
8176
8315
|
this.endOfFileToken = endOfFileToken;
|
|
8177
|
-
this.diagnostics =
|
|
8178
|
-
this.jsDiagnostics =
|
|
8179
|
-
this.jsDocDiagnostics =
|
|
8316
|
+
this.diagnostics = emptyDiagnostics;
|
|
8317
|
+
this.jsDiagnostics = emptyDiagnostics;
|
|
8318
|
+
this.jsDocDiagnostics = emptyDiagnostics;
|
|
8180
8319
|
this.languageVariant = 0;
|
|
8181
8320
|
this.scriptKind = ScriptKind.Unknown;
|
|
8182
8321
|
this.isDeclarationFile = false;
|
|
@@ -8187,17 +8326,17 @@ export class SourceFile extends Node {
|
|
|
8187
8326
|
this.nodeCount = 0;
|
|
8188
8327
|
this.textCount = 0;
|
|
8189
8328
|
this.imports = [];
|
|
8190
|
-
this.moduleAugmentations =
|
|
8191
|
-
this.ambientModuleNames =
|
|
8192
|
-
this.commentDirectives =
|
|
8193
|
-
this.pragmas =
|
|
8194
|
-
this.referencedFiles =
|
|
8195
|
-
this.typeReferenceDirectives =
|
|
8196
|
-
this.libReferenceDirectives =
|
|
8329
|
+
this.moduleAugmentations = emptyNodes;
|
|
8330
|
+
this.ambientModuleNames = emptyStrings;
|
|
8331
|
+
this.commentDirectives = emptyCommentDirectives;
|
|
8332
|
+
this.pragmas = emptyPragmas;
|
|
8333
|
+
this.referencedFiles = emptyFileReferences;
|
|
8334
|
+
this.typeReferenceDirectives = emptyFileReferences;
|
|
8335
|
+
this.libReferenceDirectives = emptyFileReferences;
|
|
8197
8336
|
this.checkJsDirective = undefined;
|
|
8198
8337
|
this.commonJSModuleIndicator = undefined;
|
|
8199
8338
|
this.externalModuleIndicator = undefined;
|
|
8200
|
-
this.reparsedClones =
|
|
8339
|
+
this.reparsedClones = emptyNodes;
|
|
8201
8340
|
this.hasLazyJSDoc = false;
|
|
8202
8341
|
this.jsDocs = undefined;
|
|
8203
8342
|
this.diagnosticFileCache = undefined;
|
|
@@ -8205,12 +8344,11 @@ export class SourceFile extends Node {
|
|
|
8205
8344
|
this.locals = undefined;
|
|
8206
8345
|
this.nextContainer = undefined;
|
|
8207
8346
|
this.isBound = false;
|
|
8208
|
-
this.bindDiagnostics =
|
|
8347
|
+
this.bindDiagnostics = emptyDiagnostics;
|
|
8209
8348
|
this.endFlowNode = undefined;
|
|
8210
8349
|
this.symbolCount = 0;
|
|
8211
|
-
this.patternAmbientModules =
|
|
8350
|
+
this.patternAmbientModules = emptyPatternAmbientModules;
|
|
8212
8351
|
this.globalExports = undefined;
|
|
8213
|
-
this.siblingProperties = undefined;
|
|
8214
8352
|
}
|
|
8215
8353
|
|
|
8216
8354
|
forEachChild(v: NodeVisitor): boolean {
|
|
@@ -8239,11 +8377,6 @@ export class SourceFile extends Node {
|
|
|
8239
8377
|
this.diagnosticFile().computeCaches();
|
|
8240
8378
|
}
|
|
8241
8379
|
|
|
8242
|
-
/** Like `computeCaches`, from the UTF-16 code units of the text (at least `text.length` of them). */
|
|
8243
|
-
computeCachesFromUnits(units: Uint16Array): void {
|
|
8244
|
-
this.diagnosticFile().computeCachesFromUnits(units);
|
|
8245
|
-
}
|
|
8246
|
-
|
|
8247
8380
|
/** The file as diagnostics see it. */
|
|
8248
8381
|
diagnosticFile(): DiagnosticFile {
|
|
8249
8382
|
let file = this.diagnosticFileCache;
|
|
@@ -8695,8 +8828,8 @@ export function getModifiers(node: Node): ModifierList | undefined {
|
|
|
8695
8828
|
}
|
|
8696
8829
|
break;
|
|
8697
8830
|
case SyntaxKind.PropertyAssignment:
|
|
8698
|
-
if (node instanceof
|
|
8699
|
-
const holder:
|
|
8831
|
+
if (node instanceof FullPropertyAssignment) {
|
|
8832
|
+
const holder: FullPropertyAssignment = node;
|
|
8700
8833
|
return holder.modifiers;
|
|
8701
8834
|
}
|
|
8702
8835
|
break;
|
|
@@ -9069,8 +9202,8 @@ export function getType(node: Node): Node | undefined {
|
|
|
9069
9202
|
}
|
|
9070
9203
|
break;
|
|
9071
9204
|
case SyntaxKind.PropertyAssignment:
|
|
9072
|
-
if (node instanceof
|
|
9073
|
-
const holder:
|
|
9205
|
+
if (node instanceof FullPropertyAssignment) {
|
|
9206
|
+
const holder: FullPropertyAssignment = node;
|
|
9074
9207
|
return holder.type;
|
|
9075
9208
|
}
|
|
9076
9209
|
break;
|
|
@@ -9558,8 +9691,8 @@ export function getPostfixToken(node: Node): Node | undefined {
|
|
|
9558
9691
|
}
|
|
9559
9692
|
break;
|
|
9560
9693
|
case SyntaxKind.PropertyAssignment:
|
|
9561
|
-
if (node instanceof
|
|
9562
|
-
const holder:
|
|
9694
|
+
if (node instanceof FullPropertyAssignment) {
|
|
9695
|
+
const holder: FullPropertyAssignment = node;
|
|
9563
9696
|
return holder.postfixToken;
|
|
9564
9697
|
}
|
|
9565
9698
|
break;
|
|
@@ -9576,8 +9709,8 @@ export function getPostfixToken(node: Node): Node | undefined {
|
|
|
9576
9709
|
export function getTypeArguments(node: Node): NodeList | undefined {
|
|
9577
9710
|
switch (node.kind) {
|
|
9578
9711
|
case SyntaxKind.CallExpression:
|
|
9579
|
-
if (node instanceof
|
|
9580
|
-
const holder:
|
|
9712
|
+
if (node instanceof FullCallExpression) {
|
|
9713
|
+
const holder: FullCallExpression = node;
|
|
9581
9714
|
return holder.typeArguments;
|
|
9582
9715
|
}
|
|
9583
9716
|
break;
|
|
@@ -10831,8 +10964,8 @@ export function getSymbol(node: Node): Symbol | undefined {
|
|
|
10831
10964
|
}
|
|
10832
10965
|
break;
|
|
10833
10966
|
case SyntaxKind.CallExpression:
|
|
10834
|
-
if (node instanceof
|
|
10835
|
-
const holder:
|
|
10967
|
+
if (node instanceof FullCallExpression) {
|
|
10968
|
+
const holder: FullCallExpression = node;
|
|
10836
10969
|
return holder.symbol;
|
|
10837
10970
|
}
|
|
10838
10971
|
break;
|
|
@@ -11163,8 +11296,8 @@ export function setSymbol(node: Node, value: Symbol | undefined): void {
|
|
|
11163
11296
|
}
|
|
11164
11297
|
break;
|
|
11165
11298
|
case SyntaxKind.CallExpression:
|
|
11166
|
-
if (node instanceof
|
|
11167
|
-
const target:
|
|
11299
|
+
if (node instanceof FullCallExpression) {
|
|
11300
|
+
const target: FullCallExpression = node;
|
|
11168
11301
|
target.symbol = value;
|
|
11169
11302
|
}
|
|
11170
11303
|
break;
|
|
@@ -12153,8 +12286,8 @@ export function setNextContainer(node: Node, value: Node | undefined): void {
|
|
|
12153
12286
|
export function getFlowNode(node: Node): FlowNode | undefined {
|
|
12154
12287
|
switch (node.kind) {
|
|
12155
12288
|
case SyntaxKind.Identifier:
|
|
12156
|
-
if (node instanceof
|
|
12157
|
-
const holder:
|
|
12289
|
+
if (node instanceof ReferenceIdentifier) {
|
|
12290
|
+
const holder: ReferenceIdentifier = node;
|
|
12158
12291
|
return holder.flowNode;
|
|
12159
12292
|
}
|
|
12160
12293
|
break;
|
|
@@ -12425,8 +12558,8 @@ export function getFlowNode(node: Node): FlowNode | undefined {
|
|
|
12425
12558
|
export function setFlowNode(node: Node, value: FlowNode | undefined): void {
|
|
12426
12559
|
switch (node.kind) {
|
|
12427
12560
|
case SyntaxKind.Identifier:
|
|
12428
|
-
if (node instanceof
|
|
12429
|
-
const target:
|
|
12561
|
+
if (node instanceof ReferenceIdentifier) {
|
|
12562
|
+
const target: ReferenceIdentifier = node;
|
|
12430
12563
|
target.flowNode = value;
|
|
12431
12564
|
}
|
|
12432
12565
|
break;
|
|
@@ -47,12 +47,13 @@ import {
|
|
|
47
47
|
getTagName,
|
|
48
48
|
getText,
|
|
49
49
|
getType,
|
|
50
|
+
callQuestionDotToken,
|
|
50
51
|
} from './ast.js';
|
|
51
52
|
import { getJSDoc } from './parser.js';
|
|
52
53
|
import { isAssignmentOperator, isLeftHandSideExpression, isStringLiteralLike, nodeIsMissing } from './ast-utilities.js';
|
|
53
54
|
import { Scanner, computeLineOfPosition, skipTrivia } from './scanner.js';
|
|
54
55
|
import { SyntaxKind } from './syntax-kind.js';
|
|
55
|
-
import { InternalSymbolName, type Symbol } from './symbol.js';
|
|
56
|
+
import { getDeclarations, InternalSymbolName, type Symbol } from './symbol.js';
|
|
56
57
|
|
|
57
58
|
// Modifiers and flags
|
|
58
59
|
|
|
@@ -343,7 +344,7 @@ export function skipParentheses(node: Node): Node {
|
|
|
343
344
|
function getQuestionDotToken(node: Node): Node | undefined {
|
|
344
345
|
if (node instanceof PropertyAccessExpression) return (node as PropertyAccessExpression).questionDotToken;
|
|
345
346
|
if (node instanceof ElementAccessExpression) return (node as ElementAccessExpression).questionDotToken;
|
|
346
|
-
if (node instanceof CallExpression) return (node as CallExpression)
|
|
347
|
+
if (node instanceof CallExpression) return callQuestionDotToken(node as CallExpression);
|
|
347
348
|
if (node instanceof TaggedTemplateExpression) return (node as TaggedTemplateExpression).questionDotToken;
|
|
348
349
|
return undefined;
|
|
349
350
|
}
|
|
@@ -1003,7 +1004,7 @@ export function moduleExportNameIsDefault(node: Node): boolean {
|
|
|
1003
1004
|
}
|
|
1004
1005
|
|
|
1005
1006
|
export function getDeclarationOfKind(symbol: Symbol, kind: SyntaxKind): Node | undefined {
|
|
1006
|
-
for (const declaration of symbol
|
|
1007
|
+
for (const declaration of getDeclarations(symbol)) if (declaration.kind === kind) return declaration;
|
|
1007
1008
|
return undefined;
|
|
1008
1009
|
}
|
|
1009
1010
|
|