From 1df98f924fe334a00126e7e7806b947000c5a35e Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2022 16:50:14 -0500 Subject: [PATCH 01/24] Refactor node constructors in utilities to be classes --- src/compiler/utilities.ts | 277 ++++++++++++++++++++++++++++++++------ 1 file changed, 234 insertions(+), 43 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c96e4986172af..7594ffc0e66ba 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7,6 +7,7 @@ import { affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, + AmdDependency, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, @@ -22,6 +23,7 @@ import { AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, + AutoGenerateInfo, BinaryExpression, binarySearch, BindableObjectDefinePropertyCall, @@ -46,6 +48,7 @@ import { changeAnyExtension, CharacterCodes, CheckFlags, + CheckJsDirective, ClassDeclaration, ClassElement, ClassLikeDeclaration, @@ -100,6 +103,7 @@ import { ElementAccessExpression, EmitFlags, EmitHost, + EmitNode, EmitResolver, EmitTextWriter, emptyArray, @@ -117,6 +121,7 @@ import { every, ExportAssignment, ExportDeclaration, + ExportedModulesFromDeclarationEmit, ExportSpecifier, Expression, ExpressionStatement, @@ -127,6 +132,7 @@ import { FileExtensionInfo, fileExtensionIs, fileExtensionIsOneOf, + FileReference, FileWatcher, filter, find, @@ -139,6 +145,7 @@ import { flatMap, flatMapToMutable, flatten, + FlowNode, forEach, forEachAncestorDirectory, forEachChild, @@ -194,10 +201,11 @@ import { HasExpressionInitializer, hasExtension, HasFlowNode, - HasInitializer, hasInitializer, + HasInitializer, HasJSDoc, hasJSDocNodes, + HasLocals, HasModifiers, hasProperty, HasType, @@ -401,6 +409,7 @@ import { or, OuterExpressionKinds, PackageId, + PackageJsonInfo, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, @@ -409,6 +418,7 @@ import { Path, pathIsRelative, Pattern, + PatternAmbientModule, PostfixUnaryExpression, PrefixUnaryExpression, PrinterOptions, @@ -426,7 +436,9 @@ import { PseudoBigInt, QualifiedName, ReadonlyCollection, + ReadonlyPragmaMap, ReadonlyTextRange, + RedirectInfo, removeTrailingDirectorySeparator, RequireOrImportCall, RequireVariableStatement, @@ -7293,57 +7305,236 @@ function Signature(this: Signature, checker: TypeChecker, flags: SignatureFlags) } } -function Node(this: Mutable, kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; -} - -function Token(this: Mutable, kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.emitNode = undefined; -} - -function Identifier(this: Mutable, kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - (this as Identifier).flowNode = undefined; -} - function SourceMapSource(this: SourceMapSource, fileName: string, text: string, skipTrivia?: (pos: number) => number) { this.fileName = fileName; this.text = text; this.skipTrivia = skipTrivia || (pos => pos); } +const Node = class implements Node { + declare kind: SyntaxKind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: SyntaxKind, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.modifierFlagsCache = ModifierFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } +}; + +const Token = class implements Token { + declare kind: Kind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: Kind, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.emitNode = undefined; + } +}; + +const Identifier = class implements Identifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare _declarationBrand: any; + declare _jsdocContainerBrand: any; + declare _flowContainerBrand: any; + + declare kind: SyntaxKind.Identifier; + declare escapedText: __String; + declare originalKeywordKind?: SyntaxKind | undefined; + declare autoGenerate: AutoGenerateInfo | undefined; + declare generatedImportReference?: ImportSpecifier | undefined; + declare isInJSDocNamespace?: boolean | undefined; + declare typeArguments?: NodeArray | undefined; + declare jsdocDotPos?: number | undefined; + declare hasExtendedUnicodeEscape?: boolean | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare jsDoc?: JSDoc[] | undefined; + declare jsDocCache?: readonly JSDocTag[] | undefined; + declare flowNode?: FlowNode | undefined; + + constructor(kind: SyntaxKind.Identifier, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.flowNode = undefined; + } +}; + +const PrivateIdentifier = class implements PrivateIdentifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare kind: SyntaxKind.PrivateIdentifier; + declare escapedText: __String; + declare autoGenerate: AutoGenerateInfo | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } +}; + +const SourceFile = class implements SourceFile { + declare _declarationBrand: any; + declare _localsContainerBrand: any; + declare kind: SyntaxKind.SourceFile; + declare statements: NodeArray; + declare endOfFileToken: Token; + declare fileName: string; + declare path: Path; + declare text: string; + declare resolvedPath: Path; + declare originalFileName: string; + declare redirectInfo?: RedirectInfo | undefined; + declare amdDependencies: readonly AmdDependency[]; + declare moduleName?: string | undefined; + declare referencedFiles: readonly FileReference[]; + declare typeReferenceDirectives: readonly FileReference[]; + declare libReferenceDirectives: readonly FileReference[]; + declare languageVariant: LanguageVariant; + declare isDeclarationFile: boolean; + declare renamedDependencies?: ReadonlyMap | undefined; + declare hasNoDefaultLib: boolean; + declare languageVersion: ScriptTarget; + declare impliedNodeFormat?: ResolutionMode; + declare packageJsonLocations?: readonly string[] | undefined; + declare packageJsonScope?: PackageJsonInfo | undefined; + declare scriptKind: ScriptKind; + declare externalModuleIndicator?: true | Node | undefined; + declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; + declare commonJsModuleIndicator?: Node | undefined; + declare jsGlobalAugmentations?: SymbolTable | undefined; + declare identifiers: ReadonlyMap; + declare nodeCount: number; + declare identifierCount: number; + declare symbolCount: number; + declare parseDiagnostics: DiagnosticWithLocation[]; + declare bindDiagnostics: DiagnosticWithLocation[]; + declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; + declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; + declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; + declare lineMap: readonly number[]; + declare classifiableNames?: ReadonlySet<__String> | undefined; + declare commentDirectives?: CommentDirective[] | undefined; + declare resolvedModules?: ModeAwareCache | undefined; + declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; + declare imports: readonly StringLiteralLike[]; + declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; + declare patternAmbientModules?: PatternAmbientModule[] | undefined; + declare ambientModuleNames: readonly string[]; + declare checkJsDirective?: CheckJsDirective | undefined; + declare version: string; + declare pragmas: ReadonlyPragmaMap; + declare localJsxNamespace?: __String | undefined; + declare localJsxFragmentNamespace?: __String | undefined; + declare localJsxFactory?: EntityName | undefined; + declare localJsxFragmentFactory?: EntityName | undefined; + declare exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit | undefined; + declare endFlowNode?: FlowNode | undefined; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + declare locals?: SymbolTable | undefined; + declare nextContainer?: HasLocals | undefined; + + constructor(kind: SyntaxKind.SourceFile, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } +}; + // eslint-disable-next-line prefer-const /** @internal */ export const objectAllocator: ObjectAllocator = { - getNodeConstructor: () => Node as any, - getTokenConstructor: () => Token as any, - getIdentifierConstructor: () => Identifier as any, - getPrivateIdentifierConstructor: () => Node as any, - getSourceFileConstructor: () => Node as any, + getNodeConstructor: () => Node, + getTokenConstructor: () => Token, + getIdentifierConstructor: () => Identifier, + getPrivateIdentifierConstructor: () => PrivateIdentifier, + getSourceFileConstructor: () => SourceFile, getSymbolConstructor: () => Symbol as any, getTypeConstructor: () => Type as any, getSignatureConstructor: () => Signature as any, From 3b862b6ef5341445c9709de4eb5691458219094f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 15 Dec 2022 22:52:54 -0500 Subject: [PATCH 02/24] Move services Node classes to compiler --- src/compiler/types.ts | 75 ++- src/compiler/utilities.ts | 1019 +++++++++++++++++++++++++++++-------- src/services/services.ts | 648 +---------------------- src/services/types.ts | 90 +--- src/services/utilities.ts | 12 - 5 files changed, 886 insertions(+), 958 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 556ab6ad35385..1d445348f2309 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -906,6 +906,34 @@ export interface Node extends ReadonlyTextRange { // see: https://github.com/microsoft/TypeScript/pull/51682 } +/** @internal */ +export interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + /** @internal */ + getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures + getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + /** @internal */ + getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFileLike): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + getLastToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + // See ts.forEachChild for documentation. + forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; +} + export interface JSDocContainer extends Node { _jsdocContainerBrand: any; /** @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node @@ -1683,7 +1711,8 @@ export interface Identifier extends PrimaryExpression, Declaration, JSDocContain isInJSDocNamespace?: boolean; // if the node is a member in a JSDoc namespace /** @internal */ typeArguments?: NodeArray; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help. /** @internal */ jsdocDotPos?: number; // Identifier occurs in JSDoc-style generic: Id. - /**@internal*/ hasExtendedUnicodeEscape?: boolean; + /** @internal */ hasExtendedUnicodeEscape?: boolean; + /** @internal */ readonly text: string; } // Transient identifier node (marked by id === -1) @@ -1780,6 +1809,7 @@ export interface PrivateIdentifier extends PrimaryExpression { // avoids gotchas in transforms and utils readonly escapedText: __String; /** @internal */ readonly autoGenerate: AutoGenerateInfo | undefined; // Used for auto-generated identifiers. + /** @internal */ readonly text: string; } /** @internal */ @@ -4387,6 +4417,49 @@ export interface SourceFile extends Declaration, LocalsContainer { /** @internal */ endFlowNode?: FlowNode; } +/** @internal */ +export interface SourceFile { + /** @internal */ version: string; + /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; + /** @internal */ nameTable: UnderscoreEscapedMap | undefined; + + /** @internal */ getNamedDeclarations(): Map; + + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; + getLineStarts(): readonly number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + + /** @internal */ sourceMapper?: DocumentPositionMapper; +} + +/** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ +// eslint-disable-next-line @typescript-eslint/naming-convention +export interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + + /** Gets the length of this script snapshot. */ + getLength(): number; + + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; + + /** Releases all resources held by this script snapshot */ + dispose?(): void; +} + /** @internal */ export interface ReadonlyPragmaContext { languageVersion: ScriptTarget; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 7594ffc0e66ba..9e14905b24afc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -68,6 +68,7 @@ import { computeLineAndCharacterOfPosition, computeLineOfPosition, computeLineStarts, + computePositionOfLineAndCharacter, concatenate, ConditionalExpression, ConstructorDeclaration, @@ -107,6 +108,7 @@ import { EmitResolver, EmitTextWriter, emptyArray, + EndOfFileToken, ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, EntityName, @@ -186,6 +188,7 @@ import { getLinesBetweenPositions, getLineStarts, getNameOfDeclaration, + getNonAssignedNameOfDeclaration, getNormalizedAbsolutePath, getNormalizedPathComponents, getOwnKeys, @@ -247,6 +250,7 @@ import { isCommaListExpression, isComputedPropertyName, isConstructorDeclaration, + IScriptSnapshot, isDeclaration, isDecorator, isElementAccessExpression, @@ -274,6 +278,7 @@ import { isInterfaceDeclaration, isJSDoc, isJSDocAugmentsTag, + isJSDocCommentContainingNode, isJSDocFunctionType, isJSDocLinkLike, isJSDocMemberName, @@ -300,9 +305,11 @@ import { isMethodOrAccessor, isModuleDeclaration, isNamedDeclaration, + isNamedExports, isNamespaceExport, isNamespaceExportDeclaration, isNamespaceImport, + isNodeKind, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, @@ -326,6 +333,7 @@ import { isString, isStringLiteral, isStringLiteralLike, + isTokenKind, isTypeAliasDeclaration, isTypeElement, isTypeLiteralNode, @@ -362,6 +370,7 @@ import { lastOrUndefined, LateVisibilityPaintedStatement, length, + LineAndCharacter, LiteralImportTypeNode, LiteralLikeElementAccessExpression, LiteralLikeNode, @@ -434,6 +443,7 @@ import { PropertyNameLiteral, PropertySignature, PseudoBigInt, + Push, QualifiedName, ReadonlyCollection, ReadonlyPragmaMap, @@ -494,6 +504,7 @@ import { TemplateLiteralLikeNode, TemplateLiteralTypeSpan, TemplateSpan, + TextChangeRange, TextRange, TextSpan, ThisTypePredicate, @@ -526,8 +537,10 @@ import { TypePredicate, TypePredicateKind, TypeReferenceNode, + UnderscoreEscapedMap, unescapeLeadingUnderscores, UnionOrIntersectionTypeNode, + updateSourceFile, UserPreferences, ValidImportTypeNode, VariableDeclaration, @@ -4532,6 +4545,15 @@ export function isPushOrUnshiftIdentifier(node: Identifier) { return node.escapedText === "push" || node.escapedText === "unshift"; } +/** @internal */ +export function getNameFromPropertyName(name: PropertyName): string | undefined { + return name.kind === SyntaxKind.ComputedPropertyName + // treat computed property names where expression is string/numeric literal as just string/numeric literal + ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined + : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); +} + + /** @internal */ export function isParameterDeclaration(node: VariableLikeDeclaration): boolean { const root = getRootDeclaration(node); @@ -7311,230 +7333,799 @@ function SourceMapSource(this: SourceMapSource, fileName: string, text: string, this.skipTrivia = skipTrivia || (pos => pos); } -const Node = class implements Node { - declare kind: SyntaxKind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } -}; +export namespace NodeConstructors { + const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); -const Token = class implements Token { - declare kind: Kind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: Kind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.emitNode = undefined; - } -}; + function createChildren(node: Node, sourceFile: SourceFileLike | undefined): Node[] { + if (!isNodeKind(node.kind)) { + return emptyArray; + } -const Identifier = class implements Identifier { - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - declare _declarationBrand: any; - declare _jsdocContainerBrand: any; - declare _flowContainerBrand: any; - - declare kind: SyntaxKind.Identifier; - declare escapedText: __String; - declare originalKeywordKind?: SyntaxKind | undefined; - declare autoGenerate: AutoGenerateInfo | undefined; - declare generatedImportReference?: ImportSpecifier | undefined; - declare isInJSDocNamespace?: boolean | undefined; - declare typeArguments?: NodeArray | undefined; - declare jsdocDotPos?: number | undefined; - declare hasExtendedUnicodeEscape?: boolean | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; - declare jsDoc?: JSDoc[] | undefined; - declare jsDocCache?: readonly JSDocTag[] | undefined; - declare flowNode?: FlowNode | undefined; - - constructor(kind: SyntaxKind.Identifier, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - this.flowNode = undefined; - } -}; + const children: Node[] = []; + + if (isJSDocCommentContainingNode(node)) { + /** Don't add trivia for "tokens" since this is in a comment. */ + node.forEachChild(child => { + children.push(child); + }); + return children; + } + + scanner.setText((sourceFile || node.getSourceFile()).text); + let pos = node.pos; + const processNode = (child: Node) => { + addSyntheticNodes(children, pos, child.pos, node); + children.push(child); + pos = child.end; + }; + const processNodes = (nodes: NodeArray) => { + addSyntheticNodes(children, pos, nodes.pos, node); + children.push(createSyntaxList(nodes, node)); + pos = nodes.end; + }; -const PrivateIdentifier = class implements PrivateIdentifier { - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - declare kind: SyntaxKind.PrivateIdentifier; - declare escapedText: __String; - declare autoGenerate: AutoGenerateInfo | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; + // jsDocComments need to be the first children + if (canHaveJSDoc(node)) { + forEach(node.jsDoc, processNode); + } + + // For syntactic classifications, all trivia are classified together, including jsdoc comments. + // For that to work, the jsdoc comments should still be the leading trivia of the first child. + // Restoring the scanner position ensures that. + pos = node.pos; + node.forEachChild(processNode, processNodes); + addSyntheticNodes(children, pos, node.end, node); + scanner.setText(undefined); + return children; + } + + function addSyntheticNodes(nodes: Push, pos: number, end: number, parent: Node): void { + scanner.setTextPos(pos); + while (pos < end) { + const kind = scanner.scan(); + const textPos = scanner.getTextPos(); + if (textPos <= end) { + if (kind === SyntaxKind.Identifier) { + if (hasTabstop(parent)) { + continue; + } + Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); + } + Debug.assert(isTokenKind(kind)); + const token = new Token(kind, pos, textPos) as any as Mutable>; + token.parent = parent; + token.flags = parent.flags & NodeFlags.ContextFlags; + nodes.push(token); + } + pos = textPos; + if (kind === SyntaxKind.EndOfFileToken) { + break; + } + } } -}; -const SourceFile = class implements SourceFile { - declare _declarationBrand: any; - declare _localsContainerBrand: any; - declare kind: SyntaxKind.SourceFile; - declare statements: NodeArray; - declare endOfFileToken: Token; - declare fileName: string; - declare path: Path; - declare text: string; - declare resolvedPath: Path; - declare originalFileName: string; - declare redirectInfo?: RedirectInfo | undefined; - declare amdDependencies: readonly AmdDependency[]; - declare moduleName?: string | undefined; - declare referencedFiles: readonly FileReference[]; - declare typeReferenceDirectives: readonly FileReference[]; - declare libReferenceDirectives: readonly FileReference[]; - declare languageVariant: LanguageVariant; - declare isDeclarationFile: boolean; - declare renamedDependencies?: ReadonlyMap | undefined; - declare hasNoDefaultLib: boolean; - declare languageVersion: ScriptTarget; - declare impliedNodeFormat?: ResolutionMode; - declare packageJsonLocations?: readonly string[] | undefined; - declare packageJsonScope?: PackageJsonInfo | undefined; - declare scriptKind: ScriptKind; - declare externalModuleIndicator?: true | Node | undefined; - declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; - declare commonJsModuleIndicator?: Node | undefined; - declare jsGlobalAugmentations?: SymbolTable | undefined; - declare identifiers: ReadonlyMap; - declare nodeCount: number; - declare identifierCount: number; - declare symbolCount: number; - declare parseDiagnostics: DiagnosticWithLocation[]; - declare bindDiagnostics: DiagnosticWithLocation[]; - declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; - declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; - declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; - declare lineMap: readonly number[]; - declare classifiableNames?: ReadonlySet<__String> | undefined; - declare commentDirectives?: CommentDirective[] | undefined; - declare resolvedModules?: ModeAwareCache | undefined; - declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; - declare imports: readonly StringLiteralLike[]; - declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; - declare patternAmbientModules?: PatternAmbientModule[] | undefined; - declare ambientModuleNames: readonly string[]; - declare checkJsDirective?: CheckJsDirective | undefined; - declare version: string; - declare pragmas: ReadonlyPragmaMap; - declare localJsxNamespace?: __String | undefined; - declare localJsxFragmentNamespace?: __String | undefined; - declare localJsxFactory?: EntityName | undefined; - declare localJsxFragmentFactory?: EntityName | undefined; - declare exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit | undefined; - declare endFlowNode?: FlowNode | undefined; - declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - declare locals?: SymbolTable | undefined; - declare nextContainer?: HasLocals | undefined; - - constructor(kind: SyntaxKind.SourceFile, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; + function createSyntaxList(nodes: NodeArray, parent: Node): Node { + const list = new Node(SyntaxKind.SyntaxList, nodes.pos, nodes.end) as any as Mutable; + list.parent = parent; + list.flags = parent.flags & NodeFlags.ContextFlags; + + list._children = []; + let pos = nodes.pos; + for (const node of nodes) { + addSyntheticNodes(list._children, pos, node.pos, parent); + list._children.push(node); + pos = node.end; + } + addSyntheticNodes(list._children, pos, nodes.end, parent); + return list; } -}; + + // For internal tooling purposes its preferred that the name of the class be `Node`. Unfortunately, + // a `class Node` declaration would conflict with the import of the same name. To work around this, + // we give the class an "assigned name" by using `const Node = class ...`. + export const Node: new (kind: SyntaxKind, pos: number, end: number) => Node = class implements Node { + declare kind: SyntaxKind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + declare private _children: Node[] | undefined; + + constructor(kind: SyntaxKind, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.modifierFlagsCache = ModifierFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } + + private assertHasRealPosition(message?: string) { + // eslint-disable-next-line local/debug-assert + Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + this.assertHasRealPosition(); + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + this.assertHasRealPosition(); + return this.pos; + } + + public getEnd(): number { + this.assertHasRealPosition(); + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + this.assertHasRealPosition(); + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + this.assertHasRealPosition(); + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + this.assertHasRealPosition(); + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + this.assertHasRealPosition(); + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + this.assertHasRealPosition(); + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(sourceFile?: SourceFile): number { + return this.getChildren(sourceFile).length; + } + + public getChildAt(index: number, sourceFile?: SourceFile): Node { + return this.getChildren(sourceFile)[index]; + } + + public getChildren(sourceFile?: SourceFileLike): Node[] { + this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); + return this._children || (this._children = createChildren(this, sourceFile)); + } + + public getFirstToken(sourceFile?: SourceFileLike): Node | undefined { + this.assertHasRealPosition(); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } + + const child = find(children, kid => kid.kind < SyntaxKind.FirstJSDocNode || kid.kind > SyntaxKind.LastJSDocNode)!; + return child.kind < SyntaxKind.FirstNode ? + child : + child.getFirstToken(sourceFile); + } + + public getLastToken(sourceFile?: SourceFileLike): Node | undefined { + this.assertHasRealPosition(); + const children = this.getChildren(sourceFile); + + const child = lastOrUndefined(children); + if (!child) { + return undefined; + } + + return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); + } + + public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + return forEachChild(this, cbNode, cbNodeArray); + } + }; + + export const Token: new (kind: Kind, pos: number, end: number) => Token = class implements Token { + declare kind: Kind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: Kind, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.emitNode = undefined; + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(): number { + return this.getChildren().length; + } + + public getChildAt(index: number): Node { + return this.getChildren()[index]; + } + + public getChildren(): Node[] { + return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc || emptyArray : emptyArray; + } + + public getFirstToken(): Node | undefined { + return undefined; + } + + public getLastToken(): Node | undefined { + return undefined; + } + + public forEachChild(): T | undefined { + return undefined; + } + }; + + export const Identifier: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier = class implements Identifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare _declarationBrand: any; + declare _jsdocContainerBrand: any; + declare _flowContainerBrand: any; + + declare kind: SyntaxKind.Identifier; + declare escapedText: __String; + declare originalKeywordKind?: SyntaxKind | undefined; + declare autoGenerate: AutoGenerateInfo | undefined; + declare generatedImportReference?: ImportSpecifier | undefined; + declare isInJSDocNamespace?: boolean | undefined; + declare typeArguments?: NodeArray | undefined; + declare jsdocDotPos?: number | undefined; + declare hasExtendedUnicodeEscape?: boolean | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare jsDoc?: JSDoc[] | undefined; + declare jsDocCache?: readonly JSDocTag[] | undefined; + declare flowNode?: FlowNode | undefined; + + constructor(kind: SyntaxKind.Identifier, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.flowNode = undefined; + } + + get text(): string { + return idText(this); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(): number { + return this.getChildren().length; + } + + public getChildAt(index: number): Node { + return this.getChildren()[index]; + } + + public getChildren(): Node[] { + return emptyArray; + } + + public getFirstToken(): Node | undefined { + return undefined; + } + + public getLastToken(): Node | undefined { + return undefined; + } + + public forEachChild(): T | undefined { + return undefined; + } + + static { this.prototype.kind = SyntaxKind.Identifier; } + }; + + export const PrivateIdentifier: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier = class implements PrivateIdentifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare kind: SyntaxKind.PrivateIdentifier; + declare escapedText: __String; + declare autoGenerate: AutoGenerateInfo | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) { + this.pos = pos; + this.end = end; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } + + get text(): string { + return idText(this); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(): number { + return this.getChildren().length; + } + + public getChildAt(index: number): Node { + return this.getChildren()[index]; + } + + public getChildren(): Node[] { + return emptyArray; + } + + public getFirstToken(): Node | undefined { + return undefined; + } + + public getLastToken(): Node | undefined { + return undefined; + } + + public forEachChild(): T | undefined { + return undefined; + } + + static { this.prototype.kind = SyntaxKind.PrivateIdentifier; } + }; + + export const SourceFile: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile = class extends Node implements SourceFile { + declare _declarationBrand: any; + declare _localsContainerBrand: any; + declare kind: SyntaxKind.SourceFile; + declare statements: NodeArray; + declare endOfFileToken: Token; + declare fileName: string; + declare path: Path; + declare text: string; + declare resolvedPath: Path; + declare originalFileName: string; + declare redirectInfo?: RedirectInfo | undefined; + declare amdDependencies: readonly AmdDependency[]; + declare moduleName?: string | undefined; + declare referencedFiles: readonly FileReference[]; + declare typeReferenceDirectives: readonly FileReference[]; + declare libReferenceDirectives: readonly FileReference[]; + declare languageVariant: LanguageVariant; + declare isDeclarationFile: boolean; + declare renamedDependencies?: ReadonlyMap | undefined; + declare hasNoDefaultLib: boolean; + declare languageVersion: ScriptTarget; + declare impliedNodeFormat?: ResolutionMode; + declare packageJsonLocations?: readonly string[] | undefined; + declare packageJsonScope?: PackageJsonInfo | undefined; + declare scriptKind: ScriptKind; + declare externalModuleIndicator?: true | Node | undefined; + declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; + declare commonJsModuleIndicator?: Node | undefined; + declare jsGlobalAugmentations?: SymbolTable | undefined; + declare identifiers: ReadonlyMap; + declare nodeCount: number; + declare identifierCount: number; + declare symbolCount: number; + declare parseDiagnostics: DiagnosticWithLocation[]; + declare bindDiagnostics: DiagnosticWithLocation[]; + declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; + declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; + declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; + declare lineMap: readonly number[]; + declare classifiableNames?: ReadonlySet<__String> | undefined; + declare commentDirectives?: CommentDirective[] | undefined; + declare resolvedModules?: ModeAwareCache | undefined; + declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; + declare imports: readonly StringLiteralLike[]; + declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; + declare patternAmbientModules?: PatternAmbientModule[] | undefined; + declare ambientModuleNames: readonly string[]; + declare checkJsDirective?: CheckJsDirective | undefined; + declare version: string; + declare pragmas: ReadonlyPragmaMap; + declare localJsxNamespace?: __String | undefined; + declare localJsxFragmentNamespace?: __String | undefined; + declare localJsxFactory?: EntityName | undefined; + declare localJsxFragmentFactory?: EntityName | undefined; + declare exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit | undefined; + declare endFlowNode?: FlowNode | undefined; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare locals?: SymbolTable | undefined; + declare nextContainer?: HasLocals | undefined; + declare scriptSnapshot: IScriptSnapshot; + declare nameTable: UnderscoreEscapedMap | undefined; + + private declare namedDeclarations: Map | undefined; + + constructor(kind: SyntaxKind.SourceFile, pos: number, end: number) { + super(kind, pos, end); + } + + public update(newText: string, textChangeRange: TextChangeRange): SourceFile { + return updateSourceFile(this, newText, textChangeRange); + } + + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return getLineAndCharacterOfPosition(this, position); + } + + public getLineStarts(): readonly number[] { + return getLineStarts(this); + } + + public getPositionOfLineAndCharacter(line: number, character: number, allowEdits?: true): number { + return computePositionOfLineAndCharacter(getLineStarts(this), line, character, this.text, allowEdits); + } + + public getLineEndOfPosition(pos: number): number { + const { line } = this.getLineAndCharacterOfPosition(pos); + const lineStarts = this.getLineStarts(); + + let lastCharPos: number | undefined; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + + const fullText = this.getFullText(); + // if the new line is "\r\n", we should return the last non-new-line-character position + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + } + + public getNamedDeclarations(): Map { + if (!this.namedDeclarations) { + this.namedDeclarations = this.computeNamedDeclarations(); + } + + return this.namedDeclarations; + } + + private computeNamedDeclarations(): Map { + const result = createMultiMap(); + + this.forEachChild(visit); + + return result; + + function addDeclaration(declaration: Declaration) { + const name = getDeclarationName(declaration); + if (name) { + result.add(name, declaration); + } + } + + function getDeclarations(name: string) { + let declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; + } + + function getDeclarationName(declaration: Declaration) { + const name = getNonAssignedNameOfDeclaration(declaration); + return name && (isComputedPropertyName(name) && isPropertyAccessExpression(name.expression) ? name.expression.name.text + : isPropertyName(name) ? getNameFromPropertyName(name) : undefined); + } + + function visit(node: Node): void { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + const functionDeclaration = node as FunctionLikeDeclaration; + const declarationName = getDeclarationName(functionDeclaration); + + if (declarationName) { + const declarations = getDeclarations(declarationName); + const lastDeclaration = lastOrUndefined(declarations); + + // Check whether this declaration belongs to an "overload group". + if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { + // Overwrite the last declaration if it was an overload + // and this one is an implementation. + if (functionDeclaration.body && !(lastDeclaration as FunctionLikeDeclaration).body) { + declarations[declarations.length - 1] = functionDeclaration; + } + } + else { + declarations.push(functionDeclaration); + } + } + forEachChild(node, visit); + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.TypeLiteral: + addDeclaration(node as Declaration); + forEachChild(node, visit); + break; + + case SyntaxKind.Parameter: + // Only consider parameter properties + if (!hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { + break; + } + // falls through + + case SyntaxKind.VariableDeclaration: + case SyntaxKind.BindingElement: { + const decl = node as VariableDeclaration; + if (isBindingPattern(decl.name)) { + forEachChild(decl.name, visit); + break; + } + if (decl.initializer) { + visit(decl.initializer); + } + } + // falls through + case SyntaxKind.EnumMember: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + addDeclaration(node as Declaration); + break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + const exportDeclaration = node as ExportDeclaration; + if (exportDeclaration.exportClause) { + if (isNamedExports(exportDeclaration.exportClause)) { + forEach(exportDeclaration.exportClause.elements, visit); + } + else { + visit(exportDeclaration.exportClause.name); + } + } + break; + + case SyntaxKind.ImportDeclaration: + const importClause = (node as ImportDeclaration).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + addDeclaration(importClause.name); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + addDeclaration(importClause.namedBindings); + } + else { + forEach(importClause.namedBindings.elements, visit); + } + } + } + break; + + case SyntaxKind.BinaryExpression: + if (getAssignmentDeclarationKind(node as BinaryExpression) !== AssignmentDeclarationKind.None) { + addDeclaration(node as BinaryExpression); + } + // falls through + + default: + forEachChild(node, visit); + } + } + } + + static { this.prototype.kind = SyntaxKind.SourceFile; } + }; +} + // eslint-disable-next-line prefer-const /** @internal */ export const objectAllocator: ObjectAllocator = { - getNodeConstructor: () => Node, - getTokenConstructor: () => Token, - getIdentifierConstructor: () => Identifier, - getPrivateIdentifierConstructor: () => PrivateIdentifier, - getSourceFileConstructor: () => SourceFile, + getNodeConstructor: () => NodeConstructors.Node as any, + getTokenConstructor: () => NodeConstructors.Token as any, + getIdentifierConstructor: () => NodeConstructors.Identifier as any, + getPrivateIdentifierConstructor: () => NodeConstructors.PrivateIdentifier as any, + getSourceFileConstructor: () => NodeConstructors.SourceFile as any, getSymbolConstructor: () => Symbol as any, getTypeConstructor: () => Type as any, getSignatureConstructor: () => Signature as any, diff --git a/src/services/services.ts b/src/services/services.ts index 0071e942139a6..3e0d572ef6486 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5,10 +5,7 @@ import { __String, ApplicableRefactorInfo, ApplyCodeActionCommandResult, - AssignmentDeclarationKind, - AutoGenerateInfo, BaseType, - BinaryExpression, BreakpointResolver, CallHierarchy, CallHierarchyIncomingCall, @@ -17,7 +14,6 @@ import { CancellationToken, changeCompilerHostLikeToUseCache, CharacterCodes, - CheckJsDirective, Classifications, ClassifiedSpan, ClassifiedSpan2020, @@ -35,11 +31,9 @@ import { CompletionEntryDetails, CompletionInfo, Completions, - computePositionOfLineAndCharacter, computeSuggestionDiagnostics, createDocumentRegistry, createGetCanonicalFileName, - createMultiMap, createProgram, CreateProgramOptions, createSourceFile, @@ -65,14 +59,9 @@ import { EmitTextWriter, emptyArray, emptyOptions, - EndOfFileToken, - EntityName, equateValues, - ExportDeclaration, - FileReference, FileTextChanges, filter, - find, FindAllReferences, findChildOfKind, findPrecedingToken, @@ -85,10 +74,8 @@ import { FormatCodeOptions, FormatCodeSettings, formatting, - FunctionLikeDeclaration, getAdjustedRenameLocation, getAllSuperTypeNodes, - getAssignmentDeclarationKind, GetCompletionsAtPositionOptions, getContainerNode, getDefaultLibFileName, @@ -100,20 +87,16 @@ import { getImpliedNodeFormatForFile, getJSDocTags, getLineAndCharacterOfPosition, - getLineStarts, getMappedDocumentSpan, getNameFromPropertyName, getNewLineCharacter, getNewLineOrDefaultFromHost, - getNonAssignedNameOfDeclaration, getNormalizedAbsolutePath, getObjectFlags, getScriptKind, getSetExternalModuleIndicator, getSnapshotText, - getSourceFileOfNode, getSourceMapper, - getTokenPosOfNode, getTouchingPropertyName, getTouchingToken, GoToDefinition, @@ -121,17 +104,12 @@ import { hasJSDocNodes, hasProperty, hasStaticModifier, - hasSyntacticModifier, - hasTabstop, HighlightSpanKind, HostCancellationToken, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, - Identifier, identity, - idText, ImplementationLocation, - ImportDeclaration, IndexKind, IndexType, InlayHint, @@ -141,8 +119,6 @@ import { InterfaceType, IntersectionType, isArray, - isBindingPattern, - isComputedPropertyName, isConstTypeReference, IScriptSnapshot, isDeclarationName, @@ -155,7 +131,6 @@ import { isInString, isInTemplateString, isIntrinsicJsxName, - isJSDocCommentContainingNode, isJsxAttributes, isJsxClosingElement, isJsxElement, @@ -165,17 +140,13 @@ import { isJsxText, isLabelName, isLiteralComputedPropertyDeclarationName, - isNamedExports, isNamedTupleMember, isNameOfModuleDeclaration, isNewExpression, - isNodeKind, isObjectLiteralElement, isObjectLiteralExpression, isPrivateIdentifier, isProgramUptoDate, - isPropertyAccessExpression, - isPropertyName, isRightSideOfPropertyAccess, isRightSideOfQualifiedName, isSetAccessor, @@ -185,8 +156,6 @@ import { isThisTypeParameter, isTransientSymbol, JsDoc, - JSDoc, - JSDocContainer, JSDocTagInfo, JsonSourceFile, JsxAttributes, @@ -197,8 +166,6 @@ import { LanguageService, LanguageServiceHost, LanguageServiceMode, - LanguageVariant, - lastOrUndefined, length, LineAndCharacter, lineBreakPart, @@ -209,14 +176,12 @@ import { mapOneOrMany, maybeBind, maybeSetLocalizedDiagnosticMessages, - ModeAwareCache, - ModifierFlags, ModuleDeclaration, NavigateToItem, NavigationBarItem, NavigationTree, Node, - NodeArray, + NodeConstructors, NodeFlags, noop, normalizePath, @@ -236,13 +201,9 @@ import { ParsedCommandLine, parseJsonSourceFileConfigFileContent, Path, - positionIsSynthesized, PossibleProgramFileInfo, - PragmaMap, - PrivateIdentifier, Program, PropertyName, - Push, QuickInfo, refactor, RefactorContext, @@ -254,11 +215,8 @@ import { RenameInfo, RenameInfoOptions, RenameLocation, - ResolvedModuleWithFailedLookupLocations, ResolvedProjectReference, - ResolvedTypeReferenceDirectiveWithFailedLookupLocations, returnFalse, - scanner, ScriptElementKind, ScriptElementKindModifier, ScriptKind, @@ -277,11 +235,8 @@ import { SmartSelectionRange, SortedArray, SourceFile, - SourceFileLike, SourceMapSource, - Statement, stringContains, - StringLiteral, StringLiteralLike, StringLiteralType, Symbol, @@ -290,7 +245,6 @@ import { SymbolFlags, symbolName, SyntaxKind, - SyntaxList, tagNamesAreEquivalent, TextChange, TextChangeRange, @@ -301,14 +255,11 @@ import { timestamp, TodoComment, TodoCommentDescriptor, - Token, toPath, tracing, - TransformFlags, Type, TypeChecker, TypeFlags, - TypeNode, TypeParameter, TypePredicate, TypeReference, @@ -318,298 +269,11 @@ import { UnionType, updateSourceFile, UserPreferences, - VariableDeclaration, } from "./_namespaces/ts"; /** The version of the language service API */ export const servicesVersion = "0.8"; -function createNode(kind: TKind, pos: number, end: number, parent: Node): NodeObject | TokenObject | IdentifierObject | PrivateIdentifierObject { - const node = isNodeKind(kind) ? new NodeObject(kind, pos, end) : - kind === SyntaxKind.Identifier ? new IdentifierObject(SyntaxKind.Identifier, pos, end) : - kind === SyntaxKind.PrivateIdentifier ? new PrivateIdentifierObject(SyntaxKind.PrivateIdentifier, pos, end) : - new TokenObject(kind, pos, end); - node.parent = parent; - node.flags = parent.flags & NodeFlags.ContextFlags; - return node; -} - -class NodeObject implements Node { - public kind: SyntaxKind; - public pos: number; - public end: number; - public flags: NodeFlags; - public modifierFlagsCache: ModifierFlags; - public transformFlags: TransformFlags; - public parent: Node; - public symbol!: Symbol; // Actually optional, but it was too annoying to access `node.symbol!` everywhere since in many cases we know it must be defined - public jsDoc?: JSDoc[]; - public original?: Node; - private _children: Node[] | undefined; - - constructor(kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.kind = kind; - } - - private assertHasRealPosition(message?: string) { - // eslint-disable-next-line local/debug-assert - Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - this.assertHasRealPosition(); - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - this.assertHasRealPosition(); - return this.pos; - } - - public getEnd(): number { - this.assertHasRealPosition(); - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - this.assertHasRealPosition(); - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(sourceFile?: SourceFile): number { - return this.getChildren(sourceFile).length; - } - - public getChildAt(index: number, sourceFile?: SourceFile): Node { - return this.getChildren(sourceFile)[index]; - } - - public getChildren(sourceFile?: SourceFileLike): Node[] { - this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); - return this._children || (this._children = createChildren(this, sourceFile)); - } - - public getFirstToken(sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - if (!children.length) { - return undefined; - } - - const child = find(children, kid => kid.kind < SyntaxKind.FirstJSDocNode || kid.kind > SyntaxKind.LastJSDocNode)!; - return child.kind < SyntaxKind.FirstNode ? - child : - child.getFirstToken(sourceFile); - } - - public getLastToken(sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - - const child = lastOrUndefined(children); - if (!child) { - return undefined; - } - - return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); - } - - public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { - return forEachChild(this, cbNode, cbNodeArray); - } -} - -function createChildren(node: Node, sourceFile: SourceFileLike | undefined): Node[] { - if (!isNodeKind(node.kind)) { - return emptyArray; - } - - const children: Node[] = []; - - if (isJSDocCommentContainingNode(node)) { - /** Don't add trivia for "tokens" since this is in a comment. */ - node.forEachChild(child => { - children.push(child); - }); - return children; - } - - scanner.setText((sourceFile || node.getSourceFile()).text); - let pos = node.pos; - const processNode = (child: Node) => { - addSyntheticNodes(children, pos, child.pos, node); - children.push(child); - pos = child.end; - }; - const processNodes = (nodes: NodeArray) => { - addSyntheticNodes(children, pos, nodes.pos, node); - children.push(createSyntaxList(nodes, node)); - pos = nodes.end; - }; - // jsDocComments need to be the first children - forEach((node as JSDocContainer).jsDoc, processNode); - // For syntactic classifications, all trivia are classified together, including jsdoc comments. - // For that to work, the jsdoc comments should still be the leading trivia of the first child. - // Restoring the scanner position ensures that. - pos = node.pos; - node.forEachChild(processNode, processNodes); - addSyntheticNodes(children, pos, node.end, node); - scanner.setText(undefined); - return children; -} - -function addSyntheticNodes(nodes: Push, pos: number, end: number, parent: Node): void { - scanner.setTextPos(pos); - while (pos < end) { - const token = scanner.scan(); - const textPos = scanner.getTextPos(); - if (textPos <= end) { - if (token === SyntaxKind.Identifier) { - if (hasTabstop(parent)) { - continue; - } - Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); - } - nodes.push(createNode(token, pos, textPos, parent)); - } - pos = textPos; - if (token === SyntaxKind.EndOfFileToken) { - break; - } - } -} - -function createSyntaxList(nodes: NodeArray, parent: Node): Node { - const list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, parent) as any as SyntaxList; - list._children = []; - let pos = nodes.pos; - for (const node of nodes) { - addSyntheticNodes(list._children, pos, node.pos, parent); - list._children.push(node); - pos = node.end; - } - addSyntheticNodes(list._children, pos, nodes.end, parent); - return list; -} - -class TokenOrIdentifierObject implements Node { - public kind!: SyntaxKind; - public pos: number; - public end: number; - public flags: NodeFlags; - public modifierFlagsCache: ModifierFlags; - public transformFlags: TransformFlags; - public parent: Node; - public symbol!: Symbol; - public jsDocComments?: JSDoc[]; - - constructor(pos: number, end: number) { - // Set properties in same order as NodeObject - this.pos = pos; - this.end = end; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(): number { - return this.getChildren().length; - } - - public getChildAt(index: number): Node { - return this.getChildren()[index]; - } - - public getChildren(): Node[] { - return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc || emptyArray : emptyArray; - } - - public getFirstToken(): Node | undefined { - return undefined; - } - - public getLastToken(): Node | undefined { - return undefined; - } - - public forEachChild(): T | undefined { - return undefined; - } -} - class SymbolObject implements Symbol { flags: SymbolFlags; escapedName: __String; @@ -723,58 +387,6 @@ class SymbolObject implements Symbol { } } -class TokenObject extends TokenOrIdentifierObject implements Token { - public kind: TKind; - - constructor(kind: TKind, pos: number, end: number) { - super(pos, end); - this.kind = kind; - } -} - -class IdentifierObject extends TokenOrIdentifierObject implements Identifier { - public kind: SyntaxKind.Identifier = SyntaxKind.Identifier; - public escapedText!: __String; - public autoGenerate: AutoGenerateInfo | undefined; - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - declare _declarationBrand: any; - declare _jsdocContainerBrand: any; - declare _flowContainerBrand: any; - /** @internal */typeArguments!: NodeArray; - constructor(_kind: SyntaxKind.Identifier, pos: number, end: number) { - super(pos, end); - } - - get text(): string { - return idText(this); - } -} -IdentifierObject.prototype.kind = SyntaxKind.Identifier; -class PrivateIdentifierObject extends TokenOrIdentifierObject implements PrivateIdentifier { - public kind: SyntaxKind.PrivateIdentifier = SyntaxKind.PrivateIdentifier; - public escapedText!: __String; - public autoGenerate: AutoGenerateInfo | undefined; - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - constructor(_kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) { - super(pos, end); - } - - get text(): string { - return idText(this); - } -} -PrivateIdentifierObject.prototype.kind = SyntaxKind.PrivateIdentifier; - class TypeObject implements Type { checker: TypeChecker; flags: TypeFlags; @@ -995,253 +607,6 @@ function findBaseOfDeclaration(checker: TypeChecker, declaration: Declaration }); } -class SourceFileObject extends NodeObject implements SourceFile { - public kind: SyntaxKind.SourceFile = SyntaxKind.SourceFile; - declare _declarationBrand: any; - declare _localsContainerBrand: any; - public fileName!: string; - public path!: Path; - public resolvedPath!: Path; - public originalFileName!: string; - public text!: string; - public scriptSnapshot!: IScriptSnapshot; - public lineMap!: readonly number[]; - - public statements!: NodeArray; - public endOfFileToken!: Token; - - public amdDependencies!: { name: string; path: string }[]; - public moduleName!: string; - public referencedFiles!: FileReference[]; - public typeReferenceDirectives!: FileReference[]; - public libReferenceDirectives!: FileReference[]; - - public syntacticDiagnostics!: DiagnosticWithLocation[]; - public parseDiagnostics!: DiagnosticWithLocation[]; - public bindDiagnostics!: DiagnosticWithLocation[]; - public bindSuggestionDiagnostics?: DiagnosticWithLocation[]; - - public isDeclarationFile!: boolean; - public isDefaultLib!: boolean; - public hasNoDefaultLib!: boolean; - public externalModuleIndicator!: Node; // The first node that causes this file to be an external module - public commonJsModuleIndicator!: Node; // The first node that causes this file to be a CommonJS module - public nodeCount!: number; - public identifierCount!: number; - public symbolCount!: number; - public version!: string; - public scriptKind!: ScriptKind; - public languageVersion!: ScriptTarget; - public languageVariant!: LanguageVariant; - public identifiers!: Map; - public nameTable: UnderscoreEscapedMap | undefined; - public resolvedModules: ModeAwareCache | undefined; - public resolvedTypeReferenceDirectiveNames!: ModeAwareCache; - public imports!: readonly StringLiteralLike[]; - public moduleAugmentations!: StringLiteral[]; - private namedDeclarations: Map | undefined; - public ambientModuleNames!: string[]; - public checkJsDirective: CheckJsDirective | undefined; - public errorExpectations: TextRange[] | undefined; - public possiblyContainDynamicImport?: boolean; - public pragmas!: PragmaMap; - public localJsxFactory: EntityName | undefined; - public localJsxNamespace: __String | undefined; - - constructor(kind: SyntaxKind, pos: number, end: number) { - super(kind, pos, end); - } - - public update(newText: string, textChangeRange: TextChangeRange): SourceFile { - return updateSourceFile(this, newText, textChangeRange); - } - - public getLineAndCharacterOfPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); - } - - public getLineStarts(): readonly number[] { - return getLineStarts(this); - } - - public getPositionOfLineAndCharacter(line: number, character: number, allowEdits?: true): number { - return computePositionOfLineAndCharacter(getLineStarts(this), line, character, this.text, allowEdits); - } - - public getLineEndOfPosition(pos: number): number { - const { line } = this.getLineAndCharacterOfPosition(pos); - const lineStarts = this.getLineStarts(); - - let lastCharPos: number | undefined; - if (line + 1 >= lineStarts.length) { - lastCharPos = this.getEnd(); - } - if (!lastCharPos) { - lastCharPos = lineStarts[line + 1] - 1; - } - - const fullText = this.getFullText(); - // if the new line is "\r\n", we should return the last non-new-line-character position - return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; - } - - public getNamedDeclarations(): Map { - if (!this.namedDeclarations) { - this.namedDeclarations = this.computeNamedDeclarations(); - } - - return this.namedDeclarations; - } - - private computeNamedDeclarations(): Map { - const result = createMultiMap(); - - this.forEachChild(visit); - - return result; - - function addDeclaration(declaration: Declaration) { - const name = getDeclarationName(declaration); - if (name) { - result.add(name, declaration); - } - } - - function getDeclarations(name: string) { - let declarations = result.get(name); - if (!declarations) { - result.set(name, declarations = []); - } - return declarations; - } - - function getDeclarationName(declaration: Declaration) { - const name = getNonAssignedNameOfDeclaration(declaration); - return name && (isComputedPropertyName(name) && isPropertyAccessExpression(name.expression) ? name.expression.name.text - : isPropertyName(name) ? getNameFromPropertyName(name) : undefined); - } - - function visit(node: Node): void { - switch (node.kind) { - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - const functionDeclaration = node as FunctionLikeDeclaration; - const declarationName = getDeclarationName(functionDeclaration); - - if (declarationName) { - const declarations = getDeclarations(declarationName); - const lastDeclaration = lastOrUndefined(declarations); - - // Check whether this declaration belongs to an "overload group". - if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { - // Overwrite the last declaration if it was an overload - // and this one is an implementation. - if (functionDeclaration.body && !(lastDeclaration as FunctionLikeDeclaration).body) { - declarations[declarations.length - 1] = functionDeclaration; - } - } - else { - declarations.push(functionDeclaration); - } - } - forEachChild(node, visit); - break; - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeAliasDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ExportSpecifier: - case SyntaxKind.ImportSpecifier: - case SyntaxKind.ImportClause: - case SyntaxKind.NamespaceImport: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.TypeLiteral: - addDeclaration(node as Declaration); - forEachChild(node, visit); - break; - - case SyntaxKind.Parameter: - // Only consider parameter properties - if (!hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { - break; - } - // falls through - - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: { - const decl = node as VariableDeclaration; - if (isBindingPattern(decl.name)) { - forEachChild(decl.name, visit); - break; - } - if (decl.initializer) { - visit(decl.initializer); - } - } - // falls through - case SyntaxKind.EnumMember: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - addDeclaration(node as Declaration); - break; - - case SyntaxKind.ExportDeclaration: - // Handle named exports case e.g.: - // export {a, b as B} from "mod"; - const exportDeclaration = node as ExportDeclaration; - if (exportDeclaration.exportClause) { - if (isNamedExports(exportDeclaration.exportClause)) { - forEach(exportDeclaration.exportClause.elements, visit); - } - else { - visit(exportDeclaration.exportClause.name); - } - } - break; - - case SyntaxKind.ImportDeclaration: - const importClause = (node as ImportDeclaration).importClause; - if (importClause) { - // Handle default import case e.g.: - // import d from "mod"; - if (importClause.name) { - addDeclaration(importClause.name); - } - - // Handle named bindings in imports e.g.: - // import * as NS from "mod"; - // import {a, b as B} from "mod"; - if (importClause.namedBindings) { - if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { - addDeclaration(importClause.namedBindings); - } - else { - forEach(importClause.namedBindings.elements, visit); - } - } - } - break; - - case SyntaxKind.BinaryExpression: - if (getAssignmentDeclarationKind(node as BinaryExpression) !== AssignmentDeclarationKind.None) { - addDeclaration(node as BinaryExpression); - } - // falls through - - default: - forEachChild(node, visit); - } - } - } -} - class SourceMapSourceObject implements SourceMapSource { lineMap!: number[]; constructor(public fileName: string, public text: string, public skipTrivia?: (pos: number) => number) { } @@ -1253,12 +618,11 @@ class SourceMapSourceObject implements SourceMapSource { function getServicesObjectAllocator(): ObjectAllocator { return { - getNodeConstructor: () => NodeObject, - getTokenConstructor: () => TokenObject, - - getIdentifierConstructor: () => IdentifierObject, - getPrivateIdentifierConstructor: () => PrivateIdentifierObject, - getSourceFileConstructor: () => SourceFileObject, + getNodeConstructor: () => NodeConstructors.Node, + getTokenConstructor: () => NodeConstructors.Token, + getIdentifierConstructor: () => NodeConstructors.Identifier, + getPrivateIdentifierConstructor: () => NodeConstructors.PrivateIdentifier, + getSourceFileConstructor: () => NodeConstructors.SourceFile, getSymbolConstructor: () => SymbolObject, getTypeConstructor: () => TypeObject, getSignatureConstructor: () => SignatureObject, diff --git a/src/services/types.ts b/src/services/types.ts index ff726ff0663c7..ce59f00615bba 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -13,6 +13,7 @@ import { GetEffectiveTypeRootsHost, HasChangedAutomaticTypeDirectiveNames, HasInvalidatedResolutions, + IScriptSnapshot, LineAndCharacter, MinimalResolutionCacheHost, ModuleResolutionCache, @@ -41,50 +42,6 @@ import { UserPreferences, } from "./_namespaces/ts"; -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Node { - getSourceFile(): SourceFile; - getChildCount(sourceFile?: SourceFile): number; - getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; - /** @internal */ - getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures - getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - /** @internal */ - getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures - getFullStart(): number; - getEnd(): number; - getWidth(sourceFile?: SourceFileLike): number; - getFullWidth(): number; - getLeadingTriviaWidth(sourceFile?: SourceFile): number; - getFullText(sourceFile?: SourceFile): string; - getText(sourceFile?: SourceFile): string; - getFirstToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - getLastToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - // See ts.forEachChild for documentation. - forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Identifier { - readonly text: string; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface PrivateIdentifier { - readonly text: string; - } -} - declare module "../compiler/types" { // Module transform: converted from interface augmentation export interface Symbol { @@ -154,25 +111,6 @@ declare module "../compiler/types" { } } -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface SourceFile { - /** @internal */ version: string; - /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; - /** @internal */ nameTable: UnderscoreEscapedMap | undefined; - - /** @internal */ getNamedDeclarations(): Map; - - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getLineEndOfPosition(pos: number): number; - getLineStarts(): readonly number[]; - getPositionOfLineAndCharacter(line: number, character: number): number; - update(newText: string, textChangeRange: TextChangeRange): SourceFile; - - /** @internal */ sourceMapper?: DocumentPositionMapper; - } -} - declare module "../compiler/types" { // Module transform: converted from interface augmentation export interface SourceFileLike { @@ -187,32 +125,6 @@ declare module "../compiler/types" { } } -/** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the - * snapshot is observably immutable. i.e. the same calls with the same parameters will return - * the same values. - */ -// eslint-disable-next-line @typescript-eslint/naming-convention -export interface IScriptSnapshot { - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; - - /** Gets the length of this script snapshot. */ - getLength(): number; - - /** - * Gets the TextChangeRange that describe how the text changed between this text and - * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the - * change range cannot be determined. However, in that case, incremental parsing will - * not happen and the entire document will be re - parsed. - */ - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - - /** Releases all resources held by this script snapshot */ - dispose?(): void; -} - export namespace ScriptSnapshot { class StringScriptSnapshot implements IScriptSnapshot { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 3ac4c255fdde5..4d07329f866cf 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -100,7 +100,6 @@ import { getSourceFileOfNode, getSpanOfTokenAtPosition, getSymbolId, - getTextOfIdentifierOrLiteral, getTextOfNode, getTypesPackageName, hasSyntacticModifier, @@ -108,7 +107,6 @@ import { Identifier, identifierIsThisKeyword, identity, - idText, IfStatement, ImportClause, ImportDeclaration, @@ -219,7 +217,6 @@ import { isStringDoubleQuoted, isStringLiteral, isStringLiteralLike, - isStringOrNumericLiteralLike, isStringTextContainingNode, isSyntaxList, isTaggedTemplateExpression, @@ -286,7 +283,6 @@ import { ProjectPackageJsonInfo, PropertyAccessExpression, PropertyAssignment, - PropertyName, QualifiedName, RefactorContext, Scanner, @@ -2358,14 +2354,6 @@ export function skipConstraint(type: Type): Type { return type.isTypeParameter() ? type.getConstraint() || type : type; } -/** @internal */ -export function getNameFromPropertyName(name: PropertyName): string | undefined { - return name.kind === SyntaxKind.ComputedPropertyName - // treat computed property names where expression is string/numeric literal as just string/numeric literal - ? isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined - : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); -} - /** @internal */ export function programContainsModules(program: Program): boolean { return program.getSourceFiles().some(s => !s.isDeclarationFile && !program.isSourceFileFromExternalLibrary(s) && !!(s.externalModuleIndicator || s.commonJsModuleIndicator)); From cadf6e889973d0caddf9eea6d348744eb2d6edb6 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 16 Dec 2022 18:08:10 -0500 Subject: [PATCH 03/24] Remove objectAllocator --- scripts/dtsBundler.mjs | 1 + .../_namespaces/ts.NodeConstructors.ts | 1 + .../_namespaces/ts.ObjectConstructors.ts | 1 + src/compiler/_namespaces/ts.ts | 8 + src/compiler/binder.ts | 7 +- src/compiler/checker.ts | 18 +- src/compiler/debug.ts | 26 +- src/compiler/factory/baseNodeFactory.ts | 30 +- src/compiler/factory/nodeFactory.ts | 27 +- src/compiler/nodeConstructors.ts | 761 +++++++++++++++ src/compiler/objectConstructors.ts | 307 ++++++ src/compiler/parser.ts | 41 +- src/compiler/types.ts | 75 +- src/compiler/utilities.ts | 883 ------------------ .../4.0/nodeFactoryTopLevelExports.ts | 6 +- src/services/services.ts | 509 +++++----- src/services/types.ts | 82 +- ...Correctly.@@ does not start a new tag.json | 2 - ...ocComments.parsesCorrectly.@link tags.json | 17 - ...y.Chained tags, no leading whitespace.json | 4 - ...ts.parsesCorrectly.Nested @param tags.json | 6 - ...parsesCorrectly.argSynonymForParamTag.json | 3 - ...sCorrectly.argumentSynonymForParamTag.json | 3 - ...DocComments.parsesCorrectly.authorTag.json | 19 - ...sCorrectly.consecutive newline tokens.json | 1 - ...omments.parsesCorrectly.exceptionTag1.json | 2 - ...omments.parsesCorrectly.exceptionTag2.json | 1 - ...omments.parsesCorrectly.exceptionTag3.json | 2 - ...ments.parsesCorrectly.leadingAsterisk.json | 2 - ...less-than and greater-than characters.json | 2 - ...ly.no space before @ is not a new tag.json | 6 - ...nts.parsesCorrectly.noLeadingAsterisk.json | 2 - ...Comments.parsesCorrectly.noReturnType.json | 1 - ...cComments.parsesCorrectly.oneParamTag.json | 3 - ...DocComments.parsesCorrectly.paramTag1.json | 3 - ...arsesCorrectly.paramTagBracketedName1.json | 3 - ...arsesCorrectly.paramTagBracketedName2.json | 3 - ...parsesCorrectly.paramTagNameThenType1.json | 3 - ...parsesCorrectly.paramTagNameThenType2.json | 3 - ...ents.parsesCorrectly.paramWithoutType.json | 2 - ...ocComments.parsesCorrectly.returnTag1.json | 2 - ...ocComments.parsesCorrectly.returnTag2.json | 2 - ...cComments.parsesCorrectly.returnsTag1.json | 2 - ...cComments.parsesCorrectly.templateTag.json | 2 - ...Comments.parsesCorrectly.templateTag2.json | 3 - ...Comments.parsesCorrectly.templateTag3.json | 3 - ...Comments.parsesCorrectly.templateTag4.json | 3 - ...Comments.parsesCorrectly.templateTag5.json | 3 - ...Comments.parsesCorrectly.templateTag6.json | 3 - ...ocComments.parsesCorrectly.throwsTag1.json | 2 - ...ocComments.parsesCorrectly.throwsTag2.json | 1 - ...ocComments.parsesCorrectly.throwsTag3.json | 2 - ...Comments.parsesCorrectly.twoParamTag2.json | 6 - ...parsesCorrectly.twoParamTagOnSameLine.json | 6 - .../DocComments.parsesCorrectly.typeTag.json | 2 - ...sCorrectly.typedefTagWithChildrenTags.json | 9 - ...xpressions.parsesCorrectly.arrayType1.json | 1 - ...xpressions.parsesCorrectly.arrayType2.json | 1 - ...xpressions.parsesCorrectly.arrayType3.json | 1 - ...esCorrectly.callSignatureInRecordType.json | 1 - ...s.parsesCorrectly.functionReturnType1.json | 2 - ...essions.parsesCorrectly.functionType2.json | 2 - ...rrectly.functionTypeWithTrailingComma.json | 1 - ...eExpressions.parsesCorrectly.keyword1.json | 1 - ...eExpressions.parsesCorrectly.keyword2.json | 1 - ...eExpressions.parsesCorrectly.keyword3.json | 1 - ...ns.parsesCorrectly.methodInRecordType.json | 2 - ...eExpressions.parsesCorrectly.newType1.json | 3 - ...sions.parsesCorrectly.nonNullableType.json | 1 - ...ions.parsesCorrectly.nonNullableType2.json | 1 - ...ressions.parsesCorrectly.nullableType.json | 1 - ...essions.parsesCorrectly.nullableType2.json | 1 - ...ressions.parsesCorrectly.optionalType.json | 1 - ...pressions.parsesCorrectly.recordType2.json | 1 - ...pressions.parsesCorrectly.recordType3.json | 2 - ...pressions.parsesCorrectly.recordType4.json | 2 - ...pressions.parsesCorrectly.recordType5.json | 3 - ...pressions.parsesCorrectly.recordType6.json | 3 - ...pressions.parsesCorrectly.recordType7.json | 4 - ...pressions.parsesCorrectly.recordType8.json | 1 - ...Expressions.parsesCorrectly.thisType1.json | 3 - ...sesCorrectly.topLevelNoParenUnionType.json | 2 - ...esCorrectly.trailingCommaInRecordType.json | 1 - ...ons.parsesCorrectly.tsConstructorType.json | 1 - ...ssions.parsesCorrectly.tsFunctionType.json | 1 - ...xpressions.parsesCorrectly.tupleType1.json | 1 - ...xpressions.parsesCorrectly.tupleType2.json | 2 - ...xpressions.parsesCorrectly.tupleType3.json | 3 - ...sCorrectly.tupleTypeWithTrailingComma.json | 1 - ...orrectly.typeArgumentsNotFollowingDot.json | 1 - ...xpressions.parsesCorrectly.typeOfType.json | 1 - ...ssions.parsesCorrectly.typeReference1.json | 2 - ...ssions.parsesCorrectly.typeReference2.json | 3 - ...ssions.parsesCorrectly.typeReference3.json | 2 - ...Expressions.parsesCorrectly.unionType.json | 2 - ...orrectly.unionTypeWithLeadingOperator.json | 2 - ...nTypeWithOneElementAndLeadingOperator.json | 1 - ...ressions.parsesCorrectly.variadicType.json | 1 - .../reference/api/tsserverlibrary.d.ts | 48 +- tests/baselines/reference/api/typescript.d.ts | 48 +- 100 files changed, 1540 insertions(+), 1551 deletions(-) create mode 100644 src/compiler/_namespaces/ts.NodeConstructors.ts create mode 100644 src/compiler/_namespaces/ts.ObjectConstructors.ts create mode 100644 src/compiler/nodeConstructors.ts create mode 100644 src/compiler/objectConstructors.ts diff --git a/scripts/dtsBundler.mjs b/scripts/dtsBundler.mjs index 48a161f98773c..9c44cbe13a42b 100644 --- a/scripts/dtsBundler.mjs +++ b/scripts/dtsBundler.mjs @@ -331,6 +331,7 @@ function verifyMatchingSymbols(decl) { * @param {ts.Symbol} moduleSymbol */ function emitAsNamespace(name, moduleSymbol) { + if (!(moduleSymbol.flags & ts.SymbolFlags.ValueModule)) debugger; assert(moduleSymbol.flags & ts.SymbolFlags.ValueModule, "moduleSymbol is not a module"); scopeStack.push(new Map()); diff --git a/src/compiler/_namespaces/ts.NodeConstructors.ts b/src/compiler/_namespaces/ts.NodeConstructors.ts new file mode 100644 index 0000000000000..8c79d37ff27c2 --- /dev/null +++ b/src/compiler/_namespaces/ts.NodeConstructors.ts @@ -0,0 +1 @@ +export * from "../nodeConstructors"; diff --git a/src/compiler/_namespaces/ts.ObjectConstructors.ts b/src/compiler/_namespaces/ts.ObjectConstructors.ts new file mode 100644 index 0000000000000..a546cb6c55e3b --- /dev/null +++ b/src/compiler/_namespaces/ts.ObjectConstructors.ts @@ -0,0 +1 @@ +export * from "../objectConstructors"; diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index b31b19cae7cb5..791cdc7be5904 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -72,3 +72,11 @@ import * as moduleSpecifiers from "./ts.moduleSpecifiers"; export { moduleSpecifiers }; import * as performance from "./ts.performance"; export { performance }; +/** @internal */ +import * as NodeConstructors from "./ts.NodeConstructors"; +/** @internal */ +export { NodeConstructors }; +/** @internal */ +import * as ObjectConstructors from "./ts.ObjectConstructors"; +/** @internal */ +export { ObjectConstructors }; diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index fc23222eb520b..0580b48497295 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -249,7 +249,6 @@ import { NonNullChain, NonNullExpression, NumericLiteral, - objectAllocator, ObjectLiteralExpression, OptionalChain, ParameterDeclaration, @@ -310,6 +309,7 @@ import { WhileStatement, WithStatement, } from "./_namespaces/ts"; +import { SymbolObject as SymbolObject } from "./objectConstructors"; import * as performance from "./_namespaces/ts.performance"; /** @internal */ @@ -534,7 +534,6 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { let symbolCount = 0; - let Symbol: new (flags: SymbolFlags, name: __String) => Symbol; let classifiableNames: Set<__String>; const unreachableFlow: FlowNode = { flags: FlowFlags.Unreachable }; @@ -558,8 +557,6 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { classifiableNames = new Set(); symbolCount = 0; - Symbol = objectAllocator.getSymbolConstructor(); - // Attach debugging information if necessary Debug.attachFlowNodeDebugInfo(unreachableFlow); Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow); @@ -610,7 +607,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void { function createSymbol(flags: SymbolFlags, name: __String): Symbol { symbolCount++; - return new Symbol(flags, name); + return new SymbolObject(flags, name); } function addDeclarationToSymbol(symbol: Symbol, node: Declaration, symbolFlags: SymbolFlags) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index def39591676e1..5b637d90e7ea7 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -823,7 +823,6 @@ import { nullTransformationContext, NumberLiteralType, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectFlags, ObjectFlagsType, @@ -1034,6 +1033,11 @@ import { } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; import * as moduleSpecifiers from "./_namespaces/ts.moduleSpecifiers"; +import { + SignatureObject, + SymbolObject, + TypeObject, +} from "./objectConstructors"; const ambientModuleSymbolRegex = /^".+"$/; const anon = "(anonymous)" as __String & string; @@ -1379,10 +1383,6 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { let requestedExternalEmitHelpers: ExternalEmitHelpers; let externalHelpersModule: Symbol; - const Symbol = objectAllocator.getSymbolConstructor(); - const Type = objectAllocator.getTypeConstructor(); - const Signature = objectAllocator.getSignatureConstructor(); - let typeCount = 0; let symbolCount = 0; let totalInstantiationCount = 0; @@ -2321,7 +2321,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { function createSymbol(flags: SymbolFlags, name: __String, checkFlags?: CheckFlags) { symbolCount++; - const symbol = new Symbol(flags | SymbolFlags.Transient, name) as TransientSymbol; + const symbol = new SymbolObject(flags | SymbolFlags.Transient, name) as Symbol as TransientSymbol; symbol.links = new SymbolLinks() as TransientSymbolLinks; symbol.links.checkFlags = checkFlags || CheckFlags.None; return symbol; @@ -5422,7 +5422,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function createType(flags: TypeFlags): Type { - const result = new Type(checker, flags); + const result = new TypeObject(checker, flags); typeCount++; result.id = typeCount; tracing?.recordType(result); @@ -5436,7 +5436,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { } function createOriginType(flags: TypeFlags): Type { - return new Type(checker, flags); + return new TypeObject(checker, flags); } function createIntrinsicType(kind: TypeFlags, intrinsicName: string, objectFlags = ObjectFlags.None): IntrinsicType { @@ -12269,7 +12269,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { minArgumentCount: number, flags: SignatureFlags ): Signature { - const sig = new Signature(checker, flags); + const sig = new SignatureObject(checker, flags); sig.declaration = declaration; sig.typeParameters = typeParameters; sig.parameters = parameters; diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index ffbef3ef157c4..4bb2360cd0e2c 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -68,7 +68,6 @@ import { NodeFlags, nodeIsSynthesized, noop, - objectAllocator, ObjectFlags, ObjectType, RelationComparisonResult, @@ -92,6 +91,17 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; +import { + SignatureObject, + SymbolObject, + TypeObject, +} from "./objectConstructors"; +import { + IdentifierObject, + NodeObject, + SourceFileObject, + TokenObject, +} from "./nodeConstructors"; /** @internal */ export enum LogLevel { @@ -592,7 +602,7 @@ export namespace Debug { const weakNodeTextMap = new WeakMap(); // Add additional properties in debug mode to assist with debugging. - Object.defineProperties(objectAllocator.getSymbolConstructor().prototype, { + Object.defineProperties(SymbolObject.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { value(this: Symbol) { @@ -606,7 +616,7 @@ export namespace Debug { __debugFlags: { get(this: Symbol) { return formatSymbolFlags(this.flags); } } }); - Object.defineProperties(objectAllocator.getTypeConstructor().prototype, { + Object.defineProperties(TypeObject.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { value(this: Type) { @@ -653,16 +663,16 @@ export namespace Debug { }, }); - Object.defineProperties(objectAllocator.getSignatureConstructor().prototype, { + Object.defineProperties(SignatureObject.prototype, { __debugFlags: { get(this: Signature) { return formatSignatureFlags(this.flags); } }, __debugSignatureToString: { value(this: Signature) { return this.checker?.signatureToString(this); } } }); const nodeConstructors = [ - objectAllocator.getNodeConstructor(), - objectAllocator.getIdentifierConstructor(), - objectAllocator.getTokenConstructor(), - objectAllocator.getSourceFileConstructor() + NodeObject, + IdentifierObject, + TokenObject, + SourceFileObject ]; for (const ctor of nodeConstructors) { diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts index 019d3b9e27477..6f690627eac67 100644 --- a/src/compiler/factory/baseNodeFactory.ts +++ b/src/compiler/factory/baseNodeFactory.ts @@ -1,6 +1,6 @@ +import { IdentifierObject, NodeObject, PrivateIdentifierObject, SourceFileObject, TokenObject } from "../nodeConstructors"; import { Node, - objectAllocator, SyntaxKind, } from "../_namespaces/ts"; @@ -11,9 +11,9 @@ import { * @internal */ export interface BaseNodeFactory { - createBaseSourceFileNode(kind: SyntaxKind): Node; - createBaseIdentifierNode(kind: SyntaxKind): Node; - createBasePrivateIdentifierNode(kind: SyntaxKind): Node; + createBaseSourceFileNode(): Node; + createBaseIdentifierNode(): Node; + createBasePrivateIdentifierNode(): Node; createBaseTokenNode(kind: SyntaxKind): Node; createBaseNode(kind: SyntaxKind): Node; } @@ -24,12 +24,6 @@ export interface BaseNodeFactory { * @internal */ export function createBaseNodeFactory(): BaseNodeFactory { - let NodeConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - let TokenConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - let IdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - let SourceFileConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - return { createBaseSourceFileNode, createBaseIdentifierNode, @@ -38,23 +32,23 @@ export function createBaseNodeFactory(): BaseNodeFactory { createBaseNode }; - function createBaseSourceFileNode(kind: SyntaxKind): Node { - return new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, /*pos*/ -1, /*end*/ -1); + function createBaseSourceFileNode(): Node { + return new SourceFileObject(); } - function createBaseIdentifierNode(kind: SyntaxKind): Node { - return new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1); + function createBaseIdentifierNode(): Node { + return new IdentifierObject(); } - function createBasePrivateIdentifierNode(kind: SyntaxKind): Node { - return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1); + function createBasePrivateIdentifierNode(): Node { + return new PrivateIdentifierObject(); } function createBaseTokenNode(kind: SyntaxKind): Node { - return new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, /*pos*/ -1, /*end*/ -1); + return new TokenObject(kind); } function createBaseNode(kind: SyntaxKind): Node { - return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, /*pos*/ -1, /*end*/ -1); + return new NodeObject(kind); } } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 99811f7a315f1..09fa4592c7599 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -337,7 +337,6 @@ import { nullNodeConverters, nullParenthesizerRules, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -468,6 +467,16 @@ import { WithStatement, YieldExpression, } from "../_namespaces/ts"; +// import { +// Node as NodeObject, +// Identifier as IdentifierObject, +// PrivateIdentifier as PrivateIdentifierObject, +// Token as TokenObject, +// SourceFile as SourceFileObject, +// } from "../nodeConstructors"; +import { + SourceMapSourceObject as SourceMapSourceObject, +} from "../objectConstructors"; let nextAutoGenerateId = 0; @@ -1151,7 +1160,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // function createBaseIdentifier(escapedText: __String, originalKeywordKind: SyntaxKind | undefined) { - const node = baseFactory.createBaseIdentifierNode(SyntaxKind.Identifier) as Mutable; + const node = baseFactory.createBaseIdentifierNode() as Mutable; node.originalKeywordKind = originalKeywordKind; node.escapedText = escapedText; node.autoGenerate = undefined; @@ -1248,7 +1257,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } function createBasePrivateIdentifier(escapedText: __String) { - const node = baseFactory.createBasePrivateIdentifierNode(SyntaxKind.PrivateIdentifier) as Mutable; + const node = baseFactory.createBasePrivateIdentifierNode() as Mutable; node.escapedText = escapedText; node.autoGenerate = undefined; node.transformFlags |= TransformFlags.ContainsClassFields; @@ -6024,7 +6033,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode endOfFileToken: EndOfFileToken, flags: NodeFlags ) { - const node = baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile) as Mutable; + const node = baseFactory.createBaseSourceFileNode() as Mutable; node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -6107,7 +6116,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function cloneSourceFileWorker(source: SourceFile) { // TODO: This mechanism for cloning results in megamorphic property reads and writes. In future perf-related // work, we should consider switching explicit property assignments instead of using `for..in`. - const node = baseFactory.createBaseSourceFileNode(SyntaxKind.SourceFile) as Mutable; + const node = baseFactory.createBaseSourceFileNode() as Mutable; node.flags |= source.flags & ~NodeFlags.Synthesized; for (const p in source) { if (hasProperty(node, p) || !hasProperty(source, p)) { @@ -7387,9 +7396,9 @@ function makeSynthetic(node: Node) { } const syntheticFactory: BaseNodeFactory = { - createBaseSourceFileNode: kind => makeSynthetic(baseFactory.createBaseSourceFileNode(kind)), - createBaseIdentifierNode: kind => makeSynthetic(baseFactory.createBaseIdentifierNode(kind)), - createBasePrivateIdentifierNode: kind => makeSynthetic(baseFactory.createBasePrivateIdentifierNode(kind)), + createBaseSourceFileNode: () => makeSynthetic(baseFactory.createBaseSourceFileNode()), + createBaseIdentifierNode: () => makeSynthetic(baseFactory.createBaseIdentifierNode()), + createBasePrivateIdentifierNode: () => makeSynthetic(baseFactory.createBasePrivateIdentifierNode()), createBaseTokenNode: kind => makeSynthetic(baseFactory.createBaseTokenNode(kind)), createBaseNode: kind => makeSynthetic(baseFactory.createBaseNode(kind)), }; @@ -7704,7 +7713,7 @@ let SourceMapSource: new (fileName: string, text: string, skipTrivia?: (pos: num * Create an external source map source file reference */ export function createSourceMapSource(fileName: string, text: string, skipTrivia?: (pos: number) => number): SourceMapSource { - return new (SourceMapSource || (SourceMapSource = objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia); + return new SourceMapSourceObject(fileName, text, skipTrivia); } // Utilities diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts new file mode 100644 index 0000000000000..30aa0eef6ebae --- /dev/null +++ b/src/compiler/nodeConstructors.ts @@ -0,0 +1,761 @@ +import { + __String, + AmdDependency, + AssignmentDeclarationKind, + AutoGenerateInfo, + BinaryExpression, + CheckJsDirective, + CommentDirective, + computePositionOfLineAndCharacter, + createMultiMap, + Debug, + Declaration, + DiagnosticWithLocation, + EmitNode, + EntityName, + ExportDeclaration, + ExportedModulesFromDeclarationEmit, + FileReference, + FlowNode, + forEach, + forEachChild, + FunctionLikeDeclaration, + getAssignmentDeclarationKind, + getLineAndCharacterOfPosition, + getLineStarts, + getNameFromPropertyName, + getNonAssignedNameOfDeclaration, + getSourceFileOfNode, + getTokenPosOfNode, + HasLocals, + hasSyntacticModifier, + Identifier, + idText, + ImportDeclaration, + ImportSpecifier, + isBindingPattern, + isComputedPropertyName, + IScriptSnapshot, + isNamedExports, + isPropertyAccessExpression, + isPropertyName, + JSDoc, + JSDocTag, + LanguageVariant, + lastOrUndefined, + LineAndCharacter, + ModeAwareCache, + ModifierFlags, + Node, + NodeArray, + NodeFlags, + PackageJsonInfo, + Path, + PatternAmbientModule, + positionIsSynthesized, + PrivateIdentifier, + ReadonlyPragmaMap, + RedirectInfo, + ResolutionMode, + ResolvedModuleWithFailedLookupLocations, + ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + ScriptKind, + ScriptTarget, + ServicesOnlyType, + SourceFile, + SourceFileLike, + Statement, + StringLiteral, + StringLiteralLike, + Symbol, + SymbolTable, + SyntaxKind, + TextChangeRange, + Token, + TransformFlags, + TypeNode, + TypeParameterDeclaration, + UnderscoreEscapedMap, + updateSourceFile, + VariableDeclaration, +} from "./_namespaces/ts"; + +/** @internal */ +export class NodeObject implements Node { + declare kind: SyntaxKind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + declare private _children: Node[] | undefined; + + constructor(kind: SyntaxKind) { + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.modifierFlagsCache = ModifierFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } + + private assertHasRealPosition(message?: string) { + // eslint-disable-next-line local/debug-assert + Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + this.assertHasRealPosition(); + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + this.assertHasRealPosition(); + return this.pos; + } + + public getEnd(): number { + this.assertHasRealPosition(); + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + this.assertHasRealPosition(); + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + this.assertHasRealPosition(); + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + this.assertHasRealPosition(); + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + this.assertHasRealPosition(); + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + this.assertHasRealPosition(); + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + return forEachChild(this, cbNode, cbNodeArray); + } +} + +/** @internal */ +export class TokenObject implements Token { + declare kind: Kind; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor(kind: Kind) { + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.emitNode = undefined; + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public forEachChild(): T | undefined { + return undefined; + } +} + +/** @internal */ +export class IdentifierObject implements Identifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare _declarationBrand: any; + declare _jsdocContainerBrand: any; + declare _flowContainerBrand: any; + + declare kind: SyntaxKind.Identifier; + declare escapedText: __String; + declare originalKeywordKind?: SyntaxKind | undefined; + declare autoGenerate: AutoGenerateInfo | undefined; + declare generatedImportReference?: ImportSpecifier | undefined; + declare isInJSDocNamespace?: boolean | undefined; + declare typeArguments?: NodeArray | undefined; + declare jsdocDotPos?: number | undefined; + declare hasExtendedUnicodeEscape?: boolean | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare jsDoc?: JSDoc[] | undefined; + declare jsDocCache?: readonly JSDocTag[] | undefined; + declare flowNode?: FlowNode | undefined; + + constructor() { + this.pos = -1; + this.end = -1; + this.kind = SyntaxKind.Identifier; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.flowNode = undefined; + } + + get text(): string { + return idText(this); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public forEachChild(): T | undefined { + return undefined; + } + + static { this.prototype.kind = SyntaxKind.Identifier; } +} + +/** @internal */ +export class PrivateIdentifierObject implements PrivateIdentifier { + declare _primaryExpressionBrand: any; + declare _memberExpressionBrand: any; + declare _leftHandSideExpressionBrand: any; + declare _updateExpressionBrand: any; + declare _unaryExpressionBrand: any; + declare _expressionBrand: any; + declare kind: SyntaxKind.PrivateIdentifier; + declare escapedText: __String; + declare autoGenerate: AutoGenerateInfo | undefined; + declare flags: NodeFlags; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare id?: number | undefined; + declare parent: Node; + declare original?: Node | undefined; + declare emitNode?: EmitNode | undefined; + declare pos: number; + declare end: number; + + constructor() { + this.pos = -1; + this.end = -1; + this.kind = SyntaxKind.PrivateIdentifier; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } + + get text(): string { + return idText(this); + } + + public getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + public getFullStart(): number { + return this.pos; + } + + public getEnd(): number { + return this.end; + } + + public getWidth(sourceFile?: SourceFile): number { + return this.getEnd() - this.getStart(sourceFile); + } + + public getFullWidth(): number { + return this.end - this.pos; + } + + public getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + public getFullText(sourceFile?: SourceFile): string { + return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + } + + public getText(sourceFile?: SourceFile): string { + if (!sourceFile) { + sourceFile = this.getSourceFile(); + } + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { + throw new TypeError("Not implemented"); + } + + public forEachChild(): T | undefined { + return undefined; + } + + static { this.prototype.kind = SyntaxKind.PrivateIdentifier; } +} + +/** @internal */ +export class SourceFileObject extends NodeObject implements SourceFile { + declare _declarationBrand: any; + declare _localsContainerBrand: any; + declare kind: SyntaxKind.SourceFile; + declare statements: NodeArray; + declare endOfFileToken: Token; + declare fileName: string; + declare path: Path; + declare text: string; + declare resolvedPath: Path; + declare originalFileName: string; + declare redirectInfo?: RedirectInfo | undefined; + declare amdDependencies: readonly AmdDependency[]; + declare moduleName?: string | undefined; + declare referencedFiles: readonly FileReference[]; + declare typeReferenceDirectives: readonly FileReference[]; + declare libReferenceDirectives: readonly FileReference[]; + declare languageVariant: LanguageVariant; + declare isDeclarationFile: boolean; + declare renamedDependencies?: ReadonlyMap | undefined; + declare hasNoDefaultLib: boolean; + declare languageVersion: ScriptTarget; + declare impliedNodeFormat?: ResolutionMode; + declare packageJsonLocations?: readonly string[] | undefined; + declare packageJsonScope?: PackageJsonInfo | undefined; + declare scriptKind: ScriptKind; + declare externalModuleIndicator?: true | Node | undefined; + declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; + declare commonJsModuleIndicator?: Node | undefined; + declare jsGlobalAugmentations?: SymbolTable | undefined; + declare identifiers: ReadonlyMap; + declare nodeCount: number; + declare identifierCount: number; + declare symbolCount: number; + declare parseDiagnostics: DiagnosticWithLocation[]; + declare bindDiagnostics: DiagnosticWithLocation[]; + declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; + declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; + declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; + declare lineMap: readonly number[]; + declare classifiableNames?: ReadonlySet<__String> | undefined; + declare commentDirectives?: CommentDirective[] | undefined; + declare resolvedModules?: ModeAwareCache | undefined; + declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; + declare imports: readonly StringLiteralLike[]; + declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; + declare patternAmbientModules?: PatternAmbientModule[] | undefined; + declare ambientModuleNames: readonly string[]; + declare checkJsDirective?: CheckJsDirective | undefined; + declare version: string; + declare pragmas: ReadonlyPragmaMap; + declare localJsxNamespace?: __String | undefined; + declare localJsxFragmentNamespace?: __String | undefined; + declare localJsxFactory?: EntityName | undefined; + declare localJsxFragmentFactory?: EntityName | undefined; + declare exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit | undefined; + declare endFlowNode?: FlowNode | undefined; + declare symbol: Symbol; + declare localSymbol?: Symbol | undefined; + declare modifierFlagsCache: ModifierFlags; + declare transformFlags: TransformFlags; + declare locals?: SymbolTable | undefined; + declare nextContainer?: HasLocals | undefined; + declare scriptSnapshot: IScriptSnapshot; + declare nameTable: UnderscoreEscapedMap | undefined; + + private declare namedDeclarations: Map | undefined; + + constructor() { + super(SyntaxKind.SourceFile); + } + + public update(newText: string, textChangeRange: TextChangeRange): SourceFile { + return updateSourceFile(this, newText, textChangeRange); + } + + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return getLineAndCharacterOfPosition(this, position); + } + + public getLineStarts(): readonly number[] { + return getLineStarts(this); + } + + public getPositionOfLineAndCharacter(line: number, character: number, allowEdits?: true): number { + return computePositionOfLineAndCharacter(getLineStarts(this), line, character, this.text, allowEdits); + } + + public getLineEndOfPosition(pos: number): number { + const { line } = this.getLineAndCharacterOfPosition(pos); + const lineStarts = this.getLineStarts(); + + let lastCharPos: number | undefined; + if (line + 1 >= lineStarts.length) { + lastCharPos = this.getEnd(); + } + if (!lastCharPos) { + lastCharPos = lineStarts[line + 1] - 1; + } + + const fullText = this.getFullText(); + // if the new line is "\r\n", we should return the last non-new-line-character position + return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; + } + + public getNamedDeclarations(): Map { + if (!this.namedDeclarations) { + this.namedDeclarations = this.computeNamedDeclarations(); + } + + return this.namedDeclarations; + } + + private computeNamedDeclarations(): Map { + const result = createMultiMap(); + + this.forEachChild(visit); + + return result; + + function addDeclaration(declaration: Declaration) { + const name = getDeclarationName(declaration); + if (name) { + result.add(name, declaration); + } + } + + function getDeclarations(name: string) { + let declarations = result.get(name); + if (!declarations) { + result.set(name, declarations = []); + } + return declarations; + } + + function getDeclarationName(declaration: Declaration) { + const name = getNonAssignedNameOfDeclaration(declaration); + return name && (isComputedPropertyName(name) && isPropertyAccessExpression(name.expression) ? idText(name.expression.name) + : isPropertyName(name) ? getNameFromPropertyName(name) : undefined); + } + + function visit(node: Node): void { + switch (node.kind) { + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + const functionDeclaration = node as FunctionLikeDeclaration; + const declarationName = getDeclarationName(functionDeclaration); + + if (declarationName) { + const declarations = getDeclarations(declarationName); + const lastDeclaration = lastOrUndefined(declarations); + + // Check whether this declaration belongs to an "overload group". + if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { + // Overwrite the last declaration if it was an overload + // and this one is an implementation. + if (functionDeclaration.body && !(lastDeclaration as FunctionLikeDeclaration).body) { + declarations[declarations.length - 1] = functionDeclaration; + } + } + else { + declarations.push(functionDeclaration); + } + } + forEachChild(node, visit); + break; + + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.TypeAliasDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ImportEqualsDeclaration: + case SyntaxKind.ExportSpecifier: + case SyntaxKind.ImportSpecifier: + case SyntaxKind.ImportClause: + case SyntaxKind.NamespaceImport: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.TypeLiteral: + addDeclaration(node as Declaration); + forEachChild(node, visit); + break; + + case SyntaxKind.Parameter: + // Only consider parameter properties + if (!hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { + break; + } + // falls through + + case SyntaxKind.VariableDeclaration: + case SyntaxKind.BindingElement: { + const decl = node as VariableDeclaration; + if (isBindingPattern(decl.name)) { + forEachChild(decl.name, visit); + break; + } + if (decl.initializer) { + visit(decl.initializer); + } + } + // falls through + case SyntaxKind.EnumMember: + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + addDeclaration(node as Declaration); + break; + + case SyntaxKind.ExportDeclaration: + // Handle named exports case e.g.: + // export {a, b as B} from "mod"; + const exportDeclaration = node as ExportDeclaration; + if (exportDeclaration.exportClause) { + if (isNamedExports(exportDeclaration.exportClause)) { + forEach(exportDeclaration.exportClause.elements, visit); + } + else { + visit(exportDeclaration.exportClause.name); + } + } + break; + + case SyntaxKind.ImportDeclaration: + const importClause = (node as ImportDeclaration).importClause; + if (importClause) { + // Handle default import case e.g.: + // import d from "mod"; + if (importClause.name) { + addDeclaration(importClause.name); + } + + // Handle named bindings in imports e.g.: + // import * as NS from "mod"; + // import {a, b as B} from "mod"; + if (importClause.namedBindings) { + if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { + addDeclaration(importClause.namedBindings); + } + else { + forEach(importClause.namedBindings.elements, visit); + } + } + } + break; + + case SyntaxKind.BinaryExpression: + if (getAssignmentDeclarationKind(node as BinaryExpression) !== AssignmentDeclarationKind.None) { + addDeclaration(node as BinaryExpression); + } + // falls through + + default: + forEachChild(node, visit); + } + } + } + + static { this.prototype.kind = SyntaxKind.SourceFile; } +} \ No newline at end of file diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts new file mode 100644 index 0000000000000..0ece9ca89bc30 --- /dev/null +++ b/src/compiler/objectConstructors.ts @@ -0,0 +1,307 @@ +import { + __String, + BaseType, + Debug, + Declaration, + DestructuringPattern, + getLineAndCharacterOfPosition, + getObjectFlags, + identity, + IndexKind, + IndexType, + InterfaceType, + IntersectionType, + isThisTypeParameter, + JSDocSignature, + LineAndCharacter, + LiteralType, + Node, + NumberLiteralType, + ObjectFlags, + ObjectType, + ServicesForwardRefArray, + Signature, + SignatureDeclaration, + SignatureFlags, + SignatureKind, + SourceMapSource, + StringLiteralType, + Symbol, + SymbolFlags, + symbolName, + SymbolTable, + Type, + TypeChecker, + TypeFlags, + TypeMapper, + TypeParameter, + TypePredicate, + TypeReference, + UnionOrIntersectionType, + UnionType, +} from "./_namespaces/ts"; + +/** @internal */ +export class SymbolObject implements Symbol { + declare flags: SymbolFlags; + declare escapedName: __String; + declare declarations?: Declaration[] | undefined; + declare valueDeclaration?: Declaration | undefined; + declare members?: SymbolTable | undefined; + declare exports?: SymbolTable | undefined; + declare globalExports?: SymbolTable | undefined; + declare id: number; + declare mergeId: number; + declare parent?: Symbol | undefined; + declare exportSymbol?: Symbol | undefined; + declare constEnumOnlyModule: boolean | undefined; + declare isReferenced?: SymbolFlags | undefined; + declare isReplaceableByMethod?: boolean | undefined; + declare isAssigned?: boolean | undefined; + declare assignmentDeclarationMembers?: Map | undefined; + + constructor(flags: SymbolFlags, name: __String) { + this.flags = flags; + this.escapedName = name; + this.declarations = undefined; + this.valueDeclaration = undefined; + this.id = 0; + this.mergeId = 0; + this.parent = undefined; + this.members = undefined; + this.exports = undefined; + this.exportSymbol = undefined; + this.constEnumOnlyModule = undefined; + this.isReferenced = undefined; + this.isAssigned = undefined; + (this as any).links = undefined; // used by TransientSymbol + } + + getFlags(): SymbolFlags { + return this.flags; + } + + get name(): string { + return symbolName(this); + } + + getEscapedName(): __String { + return this.escapedName; + } + + getName(): string { + return this.name; + } + + getDeclarations(): Declaration[] | undefined { + return this.declarations; + } + + getDocumentationComment(_checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> { + throw new TypeError("Not supported"); + } + + getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> { + throw new TypeError("Not supported"); + } + + getJsDocTags(_checker?: TypeChecker): ServicesForwardRefArray<"JSDocTagInfo"> { + throw new TypeError("Not supported"); + } + + getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"JSDocTagInfo"> { + throw new TypeError("Not supported"); + } +} + +/** @internal */ +export class TypeObject implements Type { + declare flags: TypeFlags; + declare id: number; + declare checker: TypeChecker; + declare symbol: Symbol; + declare pattern?: DestructuringPattern | undefined; + declare aliasSymbol?: Symbol | undefined; + declare aliasTypeArguments?: readonly Type[] | undefined; + declare permissiveInstantiation?: Type | undefined; + declare restrictiveInstantiation?: Type | undefined; + declare uniqueLiteralFilledInstantiation?: Type | undefined; + declare immediateBaseConstraint?: Type | undefined; + declare widened?: Type | undefined; + + constructor(checker: TypeChecker, flags: TypeFlags) { + // TODO: stabilize map + this.flags = flags; + this.checker = checker; + } + + getFlags(): TypeFlags { + return this.flags; + } + getSymbol(): Symbol | undefined { + return this.symbol; + } + getProperties(): Symbol[] { + return this.checker.getPropertiesOfType(this); + } + getProperty(propertyName: string): Symbol | undefined { + return this.checker.getPropertyOfType(this, propertyName); + } + getApparentProperties(): Symbol[] { + return this.checker.getAugmentedPropertiesOfType(this); + } + getCallSignatures(): readonly Signature[] { + return this.checker.getSignaturesOfType(this, SignatureKind.Call); + } + getConstructSignatures(): readonly Signature[] { + return this.checker.getSignaturesOfType(this, SignatureKind.Construct); + } + getStringIndexType(): Type | undefined { + return this.checker.getIndexTypeOfType(this, IndexKind.String); + } + getNumberIndexType(): Type | undefined { + return this.checker.getIndexTypeOfType(this, IndexKind.Number); + } + getBaseTypes(): BaseType[] | undefined { + return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; + } + isNullableType(): boolean { + return this.checker.isNullableType(this); + } + getNonNullableType(): Type { + return this.checker.getNonNullableType(this); + } + getNonOptionalType(): Type { + return this.checker.getNonOptionalType(this); + } + getConstraint(): Type | undefined { + return this.checker.getBaseConstraintOfType(this); + } + getDefault(): Type | undefined { + return this.checker.getDefaultFromTypeParameter(this); + } + + isUnion(): this is UnionType { + return !!(this.flags & TypeFlags.Union); + } + isIntersection(): this is IntersectionType { + return !!(this.flags & TypeFlags.Intersection); + } + isUnionOrIntersection(): this is UnionOrIntersectionType { + return !!(this.flags & TypeFlags.UnionOrIntersection); + } + isLiteral(): this is LiteralType { + return !!(this.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.BigIntLiteral)); + } + isStringLiteral(): this is StringLiteralType { + return !!(this.flags & TypeFlags.StringLiteral); + } + isNumberLiteral(): this is NumberLiteralType { + return !!(this.flags & TypeFlags.NumberLiteral); + } + isTypeParameter(): this is TypeParameter { + return !!(this.flags & TypeFlags.TypeParameter); + } + isClassOrInterface(): this is InterfaceType { + return !!(getObjectFlags(this) & ObjectFlags.ClassOrInterface); + } + isClass(): this is InterfaceType { + return !!(getObjectFlags(this) & ObjectFlags.Class); + } + isIndexType(): this is IndexType { + return isIndexType(this); + } + /** + * This polyfills `referenceType.typeArguments` for API consumers + */ + get typeArguments() { + if (getObjectFlags(this) & ObjectFlags.Reference) { + return this.checker.getTypeArguments(this as Type as TypeReference); + } + return undefined; + } +} + +/** @internal */ +export class SignatureObject implements Signature { + declare flags: SignatureFlags; + declare checker: TypeChecker; + declare declaration?: JSDocSignature | SignatureDeclaration | undefined; + declare typeParameters?: readonly TypeParameter[] | undefined; + declare parameters: readonly Symbol[]; + declare thisParameter?: Symbol | undefined; + declare resolvedReturnType?: Type | undefined; + declare resolvedTypePredicate?: TypePredicate | undefined; + declare minArgumentCount: number; + declare resolvedMinArgumentCount?: number | undefined; + declare target?: Signature | undefined; + declare mapper?: TypeMapper | undefined; + declare compositeSignatures?: Signature[] | undefined; + declare compositeKind?: TypeFlags | undefined; + declare erasedSignatureCache?: Signature | undefined; + declare canonicalSignatureCache?: Signature | undefined; + declare baseSignatureCache?: Signature | undefined; + declare optionalCallSignatureCache?: { inner?: Signature | undefined; outer?: Signature | undefined; } | undefined; + declare isolatedSignatureType?: ObjectType | undefined; + declare instantiations?: Map | undefined; + + constructor(checker: TypeChecker, flags: SignatureFlags) { + // TODO: stabilize map + this.flags = flags; + this.checker = checker; + } + + getDeclaration(): JSDocSignature | SignatureDeclaration { + return this.declaration ?? Debug.fail(); + } + getTypeParameters(): readonly TypeParameter[] | undefined { + return this.typeParameters; + } + getParameters(): readonly Symbol[] { + return this.parameters; + } + getReturnType(): Type { + return this.checker.getReturnTypeOfSignature(this); + } + getTypeParameterAtPosition(pos: number): Type { + const type = this.checker.getParameterType(this, pos); + if (isIndexType(type) && isThisTypeParameter(type.type)) { + const constraint = type.type.checker.getBaseConstraintOfType(type.type); + if (constraint) { + return this.checker.getIndexType(constraint); + } + } + return type; + } + + getDocumentationComment(): ServicesForwardRefArray<"SymbolDisplayPart"> { + throw new TypeError("Not implemented"); + } + + getJsDocTags(): ServicesForwardRefArray<"JSDocTagInfo"> { + throw new TypeError("Not implemented"); + } +} + +/** @internal */ +export class SourceMapSourceObject implements SourceMapSource { + declare fileName: string; + declare text: string; + declare skipTrivia: ((pos: number) => number); + declare lineMap: readonly number[]; + + constructor(fileName: string, text: string, skipTrivia: (pos: number) => number = identity) { + // TODO: stabilize map + this.fileName = fileName; + this.text = text; + this.skipTrivia = skipTrivia; + } + + public getLineAndCharacterOfPosition(pos: number): LineAndCharacter { + return getLineAndCharacterOfPosition(this, pos); + } +} + +function isIndexType(type: Type): type is IndexType { + return !!(type.flags & TypeFlags.Index); +} \ No newline at end of file diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index b7c335f09efb6..857e4dbd7edcf 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,3 +1,4 @@ +import { IdentifierObject, NodeObject, PrivateIdentifierObject, SourceFileObject, TokenObject } from "./nodeConstructors"; import * as ts from "./_namespaces/ts"; import { AccessorDeclaration, @@ -270,7 +271,6 @@ import { NoSubstitutionTemplateLiteral, NullLiteral, NumericLiteral, - objectAllocator, ObjectBindingPattern, ObjectLiteralElementLike, ObjectLiteralExpression, @@ -401,23 +401,17 @@ const enum SpeculationKind { Reparse } -let NodeConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; -let TokenConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; -let IdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; -let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; -let SourceFileConstructor: new (kind: SyntaxKind, pos?: number, end?: number) => Node; - /** * NOTE: You should not use this, it is only exported to support `createNode` in `~/src/deprecatedCompat/deprecations.ts`. * * @internal */ export const parseBaseNodeFactory: BaseNodeFactory = { - createBaseSourceFileNode: kind => new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, -1, -1), - createBaseIdentifierNode: kind => new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, -1, -1), - createBasePrivateIdentifierNode: kind => new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor()))(kind, -1, -1), - createBaseTokenNode: kind => new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, -1, -1), - createBaseNode: kind => new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, -1, -1), + createBaseSourceFileNode: () => new SourceFileObject(), + createBaseIdentifierNode: () => new IdentifierObject(), + createBasePrivateIdentifierNode: () => new PrivateIdentifierObject(), + createBaseTokenNode: kind => new TokenObject(kind), + createBaseNode: kind => new NodeObject(kind), }; /** @internal */ @@ -1416,13 +1410,6 @@ namespace Parser { const disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext; - // capture constructors in 'initializeState' to avoid null checks - let NodeConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; - let TokenConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; - let IdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; - let PrivateIdentifierConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; - let SourceFileConstructor: new (kind: SyntaxKind, pos: number, end: number) => Node; - function countNode(node: Node) { nodeCount++; return node; @@ -1431,11 +1418,11 @@ namespace Parser { // Rather than using `createBaseNodeFactory` here, we establish a `BaseNodeFactory` that closes over the // constructors above, which are reset each time `initializeState` is called. const baseNodeFactory: BaseNodeFactory = { - createBaseSourceFileNode: kind => countNode(new SourceFileConstructor(kind, /*pos*/ 0, /*end*/ 0)), - createBaseIdentifierNode: kind => countNode(new IdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), - createBasePrivateIdentifierNode: kind => countNode(new PrivateIdentifierConstructor(kind, /*pos*/ 0, /*end*/ 0)), - createBaseTokenNode: kind => countNode(new TokenConstructor(kind, /*pos*/ 0, /*end*/ 0)), - createBaseNode: kind => countNode(new NodeConstructor(kind, /*pos*/ 0, /*end*/ 0)) + createBaseSourceFileNode: () => countNode(new SourceFileObject()), + createBaseIdentifierNode: () => countNode(new IdentifierObject()), + createBasePrivateIdentifierNode: () => countNode(new PrivateIdentifierObject()), + createBaseTokenNode: kind => countNode(new TokenObject(kind)), + createBaseNode: kind => countNode(new NodeObject(kind)) }; const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory); @@ -1664,12 +1651,6 @@ namespace Parser { } function initializeState(_fileName: string, _sourceText: string, _languageVersion: ScriptTarget, _syntaxCursor: IncrementalParser.SyntaxCursor | undefined, _scriptKind: ScriptKind) { - NodeConstructor = objectAllocator.getNodeConstructor(); - TokenConstructor = objectAllocator.getTokenConstructor(); - IdentifierConstructor = objectAllocator.getIdentifierConstructor(); - PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor(); - SourceFileConstructor = objectAllocator.getSourceFileConstructor(); - fileName = normalizePath(_fileName); sourceText = _sourceText; languageVersion = _languageVersion; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1d445348f2309..473ca23d5d70f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -906,34 +906,6 @@ export interface Node extends ReadonlyTextRange { // see: https://github.com/microsoft/TypeScript/pull/51682 } -/** @internal */ -export interface Node { - getSourceFile(): SourceFile; - getChildCount(sourceFile?: SourceFile): number; - getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; - /** @internal */ - getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures - getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - /** @internal */ - getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures - getFullStart(): number; - getEnd(): number; - getWidth(sourceFile?: SourceFileLike): number; - getFullWidth(): number; - getLeadingTriviaWidth(sourceFile?: SourceFile): number; - getFullText(sourceFile?: SourceFile): string; - getText(sourceFile?: SourceFile): string; - getFirstToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - getLastToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - // See ts.forEachChild for documentation. - forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; -} - export interface JSDocContainer extends Node { _jsdocContainerBrand: any; /** @internal */ jsDoc?: JSDoc[]; // JSDoc that directly precedes this node @@ -1712,7 +1684,6 @@ export interface Identifier extends PrimaryExpression, Declaration, JSDocContain /** @internal */ typeArguments?: NodeArray; // Only defined on synthesized nodes. Though not syntactically valid, used in emitting diagnostics, quickinfo, and signature help. /** @internal */ jsdocDotPos?: number; // Identifier occurs in JSDoc-style generic: Id. /** @internal */ hasExtendedUnicodeEscape?: boolean; - /** @internal */ readonly text: string; } // Transient identifier node (marked by id === -1) @@ -1809,7 +1780,6 @@ export interface PrivateIdentifier extends PrimaryExpression { // avoids gotchas in transforms and utils readonly escapedText: __String; /** @internal */ readonly autoGenerate: AutoGenerateInfo | undefined; // Used for auto-generated identifiers. - /** @internal */ readonly text: string; } /** @internal */ @@ -4417,23 +4387,6 @@ export interface SourceFile extends Declaration, LocalsContainer { /** @internal */ endFlowNode?: FlowNode; } -/** @internal */ -export interface SourceFile { - /** @internal */ version: string; - /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; - /** @internal */ nameTable: UnderscoreEscapedMap | undefined; - - /** @internal */ getNamedDeclarations(): Map; - - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getLineEndOfPosition(pos: number): number; - getLineStarts(): readonly number[]; - getPositionOfLineAndCharacter(line: number, character: number): number; - update(newText: string, textChangeRange: TextChangeRange): SourceFile; - - /** @internal */ sourceMapper?: DocumentPositionMapper; -} - /** * Represents an immutable snapshot of a script at a specified time.Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return @@ -6187,6 +6140,7 @@ export interface Type { widened?: Type; // Cached widened form of the type } + /** @internal */ // Intrinsic types (TypeFlags.Intrinsic) export interface IntrinsicType extends Type { @@ -9869,3 +9823,30 @@ export const enum DeprecationVersion { v6_0 = "6.0", /* eslint-enable @typescript-eslint/naming-convention */ } + +/** + * Resolves to a type only when the 'services' project is loaded. Otherwise, results in `never`. + * @internal + */ +export type ServicesOnlyType = ServicesForwardRefs extends { __services: true } ? T : Fallback; + +/** + * Resolves a forward-reference to a type declared in the 'services' project. + * If 'services' is not present, results in `never`. + * @internal + */ +export type ServicesForwardRef = ServicesForwardRefs extends { [P in K]: infer T } ? T : never; + +/** + * Resolves a forward-reference to an array of a type declared in the 'services' project. + * If 'services' is not present, results in `never`. + * @internal + */ + export type ServicesForwardRefArray = ServicesOnlyType[]>; + +/** + * A registry of forward references declared in the 'services' project. + * @internal + */ +export interface ServicesForwardRefs { +} diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9e14905b24afc..22cabaa55efb8 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -7,7 +7,6 @@ import { affectsEmitOptionDeclarations, AllAccessorDeclarations, AmbientModuleDeclaration, - AmdDependency, AnyImportOrBareOrAccessedRequire, AnyImportOrReExport, AnyImportSyntax, @@ -23,7 +22,6 @@ import { AssignmentDeclarationKind, AssignmentExpression, AssignmentOperatorToken, - AutoGenerateInfo, BinaryExpression, binarySearch, BindableObjectDefinePropertyCall, @@ -48,7 +46,6 @@ import { changeAnyExtension, CharacterCodes, CheckFlags, - CheckJsDirective, ClassDeclaration, ClassElement, ClassLikeDeclaration, @@ -68,7 +65,6 @@ import { computeLineAndCharacterOfPosition, computeLineOfPosition, computeLineStarts, - computePositionOfLineAndCharacter, concatenate, ConditionalExpression, ConstructorDeclaration, @@ -104,11 +100,9 @@ import { ElementAccessExpression, EmitFlags, EmitHost, - EmitNode, EmitResolver, EmitTextWriter, emptyArray, - EndOfFileToken, ensurePathIsNonModuleName, ensureTrailingDirectorySeparator, EntityName, @@ -123,7 +117,6 @@ import { every, ExportAssignment, ExportDeclaration, - ExportedModulesFromDeclarationEmit, ExportSpecifier, Expression, ExpressionStatement, @@ -134,7 +127,6 @@ import { FileExtensionInfo, fileExtensionIs, fileExtensionIsOneOf, - FileReference, FileWatcher, filter, find, @@ -147,7 +139,6 @@ import { flatMap, flatMapToMutable, flatten, - FlowNode, forEach, forEachAncestorDirectory, forEachChild, @@ -188,7 +179,6 @@ import { getLinesBetweenPositions, getLineStarts, getNameOfDeclaration, - getNonAssignedNameOfDeclaration, getNormalizedAbsolutePath, getNormalizedPathComponents, getOwnKeys, @@ -208,7 +198,6 @@ import { HasInitializer, HasJSDoc, hasJSDocNodes, - HasLocals, HasModifiers, hasProperty, HasType, @@ -250,7 +239,6 @@ import { isCommaListExpression, isComputedPropertyName, isConstructorDeclaration, - IScriptSnapshot, isDeclaration, isDecorator, isElementAccessExpression, @@ -278,7 +266,6 @@ import { isInterfaceDeclaration, isJSDoc, isJSDocAugmentsTag, - isJSDocCommentContainingNode, isJSDocFunctionType, isJSDocLinkLike, isJSDocMemberName, @@ -305,11 +292,9 @@ import { isMethodOrAccessor, isModuleDeclaration, isNamedDeclaration, - isNamedExports, isNamespaceExport, isNamespaceExportDeclaration, isNamespaceImport, - isNodeKind, isNoSubstitutionTemplateLiteral, isNumericLiteral, isObjectLiteralExpression, @@ -333,7 +318,6 @@ import { isString, isStringLiteral, isStringLiteralLike, - isTokenKind, isTypeAliasDeclaration, isTypeElement, isTypeLiteralNode, @@ -370,7 +354,6 @@ import { lastOrUndefined, LateVisibilityPaintedStatement, length, - LineAndCharacter, LiteralImportTypeNode, LiteralLikeElementAccessExpression, LiteralLikeNode, @@ -418,7 +401,6 @@ import { or, OuterExpressionKinds, PackageId, - PackageJsonInfo, ParameterDeclaration, ParenthesizedExpression, ParenthesizedTypeNode, @@ -427,7 +409,6 @@ import { Path, pathIsRelative, Pattern, - PatternAmbientModule, PostfixUnaryExpression, PrefixUnaryExpression, PrinterOptions, @@ -443,12 +424,9 @@ import { PropertyNameLiteral, PropertySignature, PseudoBigInt, - Push, QualifiedName, ReadonlyCollection, - ReadonlyPragmaMap, ReadonlyTextRange, - RedirectInfo, removeTrailingDirectorySeparator, RequireOrImportCall, RequireVariableStatement, @@ -466,9 +444,7 @@ import { SetAccessorDeclaration, ShorthandPropertyAssignment, shouldAllowImportingTsExtension, - Signature, SignatureDeclaration, - SignatureFlags, SignatureKind, singleElementArray, singleOrUndefined, @@ -481,7 +457,6 @@ import { SourceFile, SourceFileLike, SourceFileMayBeEmittedHost, - SourceMapSource, startsWith, startsWithUseStrict, Statement, @@ -504,7 +479,6 @@ import { TemplateLiteralLikeNode, TemplateLiteralTypeSpan, TemplateSpan, - TextChangeRange, TextRange, TextSpan, ThisTypePredicate, @@ -512,7 +486,6 @@ import { TokenFlags, tokenToString, toPath, - tracing, TransformFlags, TransientSymbol, trimString, @@ -537,10 +510,8 @@ import { TypePredicate, TypePredicateKind, TypeReferenceNode, - UnderscoreEscapedMap, unescapeLeadingUnderscores, UnionOrIntersectionTypeNode, - updateSourceFile, UserPreferences, ValidImportTypeNode, VariableDeclaration, @@ -7283,860 +7254,6 @@ export function getLeftmostExpression(node: Expression, stopAtCallExpressions: b } } -/** @internal */ -export interface ObjectAllocator { - getNodeConstructor(): new (kind: SyntaxKind, pos?: number, end?: number) => Node; - getTokenConstructor(): new (kind: TKind, pos?: number, end?: number) => Token; - getIdentifierConstructor(): new (kind: SyntaxKind.Identifier, pos?: number, end?: number) => Identifier; - getPrivateIdentifierConstructor(): new (kind: SyntaxKind.PrivateIdentifier, pos?: number, end?: number) => PrivateIdentifier; - getSourceFileConstructor(): new (kind: SyntaxKind.SourceFile, pos?: number, end?: number) => SourceFile; - getSymbolConstructor(): new (flags: SymbolFlags, name: __String) => Symbol; - getTypeConstructor(): new (checker: TypeChecker, flags: TypeFlags) => Type; - getSignatureConstructor(): new (checker: TypeChecker, flags: SignatureFlags) => Signature; - getSourceMapSourceConstructor(): new (fileName: string, text: string, skipTrivia?: (pos: number) => number) => SourceMapSource; -} - -function Symbol(this: Symbol, flags: SymbolFlags, name: __String) { - this.flags = flags; - this.escapedName = name; - this.declarations = undefined; - this.valueDeclaration = undefined; - this.id = 0; - this.mergeId = 0; - this.parent = undefined; - this.members = undefined; - this.exports = undefined; - this.exportSymbol = undefined; - this.constEnumOnlyModule = undefined; - this.isReferenced = undefined; - this.isAssigned = undefined; - (this as any).links = undefined; // used by TransientSymbol -} - -function Type(this: Type, checker: TypeChecker, flags: TypeFlags) { - this.flags = flags; - if (Debug.isDebugging || tracing) { - this.checker = checker; - } -} - -function Signature(this: Signature, checker: TypeChecker, flags: SignatureFlags) { - this.flags = flags; - if (Debug.isDebugging) { - this.checker = checker; - } -} - -function SourceMapSource(this: SourceMapSource, fileName: string, text: string, skipTrivia?: (pos: number) => number) { - this.fileName = fileName; - this.text = text; - this.skipTrivia = skipTrivia || (pos => pos); -} - -export namespace NodeConstructors { - const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); - - function createChildren(node: Node, sourceFile: SourceFileLike | undefined): Node[] { - if (!isNodeKind(node.kind)) { - return emptyArray; - } - - const children: Node[] = []; - - if (isJSDocCommentContainingNode(node)) { - /** Don't add trivia for "tokens" since this is in a comment. */ - node.forEachChild(child => { - children.push(child); - }); - return children; - } - - scanner.setText((sourceFile || node.getSourceFile()).text); - let pos = node.pos; - const processNode = (child: Node) => { - addSyntheticNodes(children, pos, child.pos, node); - children.push(child); - pos = child.end; - }; - const processNodes = (nodes: NodeArray) => { - addSyntheticNodes(children, pos, nodes.pos, node); - children.push(createSyntaxList(nodes, node)); - pos = nodes.end; - }; - - // jsDocComments need to be the first children - if (canHaveJSDoc(node)) { - forEach(node.jsDoc, processNode); - } - - // For syntactic classifications, all trivia are classified together, including jsdoc comments. - // For that to work, the jsdoc comments should still be the leading trivia of the first child. - // Restoring the scanner position ensures that. - pos = node.pos; - node.forEachChild(processNode, processNodes); - addSyntheticNodes(children, pos, node.end, node); - scanner.setText(undefined); - return children; - } - - function addSyntheticNodes(nodes: Push, pos: number, end: number, parent: Node): void { - scanner.setTextPos(pos); - while (pos < end) { - const kind = scanner.scan(); - const textPos = scanner.getTextPos(); - if (textPos <= end) { - if (kind === SyntaxKind.Identifier) { - if (hasTabstop(parent)) { - continue; - } - Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); - } - Debug.assert(isTokenKind(kind)); - const token = new Token(kind, pos, textPos) as any as Mutable>; - token.parent = parent; - token.flags = parent.flags & NodeFlags.ContextFlags; - nodes.push(token); - } - pos = textPos; - if (kind === SyntaxKind.EndOfFileToken) { - break; - } - } - } - - function createSyntaxList(nodes: NodeArray, parent: Node): Node { - const list = new Node(SyntaxKind.SyntaxList, nodes.pos, nodes.end) as any as Mutable; - list.parent = parent; - list.flags = parent.flags & NodeFlags.ContextFlags; - - list._children = []; - let pos = nodes.pos; - for (const node of nodes) { - addSyntheticNodes(list._children, pos, node.pos, parent); - list._children.push(node); - pos = node.end; - } - addSyntheticNodes(list._children, pos, nodes.end, parent); - return list; - } - - // For internal tooling purposes its preferred that the name of the class be `Node`. Unfortunately, - // a `class Node` declaration would conflict with the import of the same name. To work around this, - // we give the class an "assigned name" by using `const Node = class ...`. - export const Node: new (kind: SyntaxKind, pos: number, end: number) => Node = class implements Node { - declare kind: SyntaxKind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - declare private _children: Node[] | undefined; - - constructor(kind: SyntaxKind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } - - private assertHasRealPosition(message?: string) { - // eslint-disable-next-line local/debug-assert - Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - this.assertHasRealPosition(); - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - this.assertHasRealPosition(); - return this.pos; - } - - public getEnd(): number { - this.assertHasRealPosition(); - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - this.assertHasRealPosition(); - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(sourceFile?: SourceFile): number { - return this.getChildren(sourceFile).length; - } - - public getChildAt(index: number, sourceFile?: SourceFile): Node { - return this.getChildren(sourceFile)[index]; - } - - public getChildren(sourceFile?: SourceFileLike): Node[] { - this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); - return this._children || (this._children = createChildren(this, sourceFile)); - } - - public getFirstToken(sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - if (!children.length) { - return undefined; - } - - const child = find(children, kid => kid.kind < SyntaxKind.FirstJSDocNode || kid.kind > SyntaxKind.LastJSDocNode)!; - return child.kind < SyntaxKind.FirstNode ? - child : - child.getFirstToken(sourceFile); - } - - public getLastToken(sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - - const child = lastOrUndefined(children); - if (!child) { - return undefined; - } - - return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); - } - - public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { - return forEachChild(this, cbNode, cbNodeArray); - } - }; - - export const Token: new (kind: Kind, pos: number, end: number) => Token = class implements Token { - declare kind: Kind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: Kind, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.emitNode = undefined; - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(): number { - return this.getChildren().length; - } - - public getChildAt(index: number): Node { - return this.getChildren()[index]; - } - - public getChildren(): Node[] { - return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc || emptyArray : emptyArray; - } - - public getFirstToken(): Node | undefined { - return undefined; - } - - public getLastToken(): Node | undefined { - return undefined; - } - - public forEachChild(): T | undefined { - return undefined; - } - }; - - export const Identifier: new (kind: SyntaxKind.Identifier, pos: number, end: number) => Identifier = class implements Identifier { - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - declare _declarationBrand: any; - declare _jsdocContainerBrand: any; - declare _flowContainerBrand: any; - - declare kind: SyntaxKind.Identifier; - declare escapedText: __String; - declare originalKeywordKind?: SyntaxKind | undefined; - declare autoGenerate: AutoGenerateInfo | undefined; - declare generatedImportReference?: ImportSpecifier | undefined; - declare isInJSDocNamespace?: boolean | undefined; - declare typeArguments?: NodeArray | undefined; - declare jsdocDotPos?: number | undefined; - declare hasExtendedUnicodeEscape?: boolean | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; - declare jsDoc?: JSDoc[] | undefined; - declare jsDocCache?: readonly JSDocTag[] | undefined; - declare flowNode?: FlowNode | undefined; - - constructor(kind: SyntaxKind.Identifier, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - this.flowNode = undefined; - } - - get text(): string { - return idText(this); - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(): number { - return this.getChildren().length; - } - - public getChildAt(index: number): Node { - return this.getChildren()[index]; - } - - public getChildren(): Node[] { - return emptyArray; - } - - public getFirstToken(): Node | undefined { - return undefined; - } - - public getLastToken(): Node | undefined { - return undefined; - } - - public forEachChild(): T | undefined { - return undefined; - } - - static { this.prototype.kind = SyntaxKind.Identifier; } - }; - - export const PrivateIdentifier: new (kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) => PrivateIdentifier = class implements PrivateIdentifier { - declare _primaryExpressionBrand: any; - declare _memberExpressionBrand: any; - declare _leftHandSideExpressionBrand: any; - declare _updateExpressionBrand: any; - declare _unaryExpressionBrand: any; - declare _expressionBrand: any; - declare kind: SyntaxKind.PrivateIdentifier; - declare escapedText: __String; - declare autoGenerate: AutoGenerateInfo | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: SyntaxKind.PrivateIdentifier, pos: number, end: number) { - this.pos = pos; - this.end = end; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } - - get text(): string { - return idText(this); - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(): number { - return this.getChildren().length; - } - - public getChildAt(index: number): Node { - return this.getChildren()[index]; - } - - public getChildren(): Node[] { - return emptyArray; - } - - public getFirstToken(): Node | undefined { - return undefined; - } - - public getLastToken(): Node | undefined { - return undefined; - } - - public forEachChild(): T | undefined { - return undefined; - } - - static { this.prototype.kind = SyntaxKind.PrivateIdentifier; } - }; - - export const SourceFile: new (kind: SyntaxKind.SourceFile, pos: number, end: number) => SourceFile = class extends Node implements SourceFile { - declare _declarationBrand: any; - declare _localsContainerBrand: any; - declare kind: SyntaxKind.SourceFile; - declare statements: NodeArray; - declare endOfFileToken: Token; - declare fileName: string; - declare path: Path; - declare text: string; - declare resolvedPath: Path; - declare originalFileName: string; - declare redirectInfo?: RedirectInfo | undefined; - declare amdDependencies: readonly AmdDependency[]; - declare moduleName?: string | undefined; - declare referencedFiles: readonly FileReference[]; - declare typeReferenceDirectives: readonly FileReference[]; - declare libReferenceDirectives: readonly FileReference[]; - declare languageVariant: LanguageVariant; - declare isDeclarationFile: boolean; - declare renamedDependencies?: ReadonlyMap | undefined; - declare hasNoDefaultLib: boolean; - declare languageVersion: ScriptTarget; - declare impliedNodeFormat?: ResolutionMode; - declare packageJsonLocations?: readonly string[] | undefined; - declare packageJsonScope?: PackageJsonInfo | undefined; - declare scriptKind: ScriptKind; - declare externalModuleIndicator?: true | Node | undefined; - declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; - declare commonJsModuleIndicator?: Node | undefined; - declare jsGlobalAugmentations?: SymbolTable | undefined; - declare identifiers: ReadonlyMap; - declare nodeCount: number; - declare identifierCount: number; - declare symbolCount: number; - declare parseDiagnostics: DiagnosticWithLocation[]; - declare bindDiagnostics: DiagnosticWithLocation[]; - declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; - declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; - declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; - declare lineMap: readonly number[]; - declare classifiableNames?: ReadonlySet<__String> | undefined; - declare commentDirectives?: CommentDirective[] | undefined; - declare resolvedModules?: ModeAwareCache | undefined; - declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; - declare imports: readonly StringLiteralLike[]; - declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; - declare patternAmbientModules?: PatternAmbientModule[] | undefined; - declare ambientModuleNames: readonly string[]; - declare checkJsDirective?: CheckJsDirective | undefined; - declare version: string; - declare pragmas: ReadonlyPragmaMap; - declare localJsxNamespace?: __String | undefined; - declare localJsxFragmentNamespace?: __String | undefined; - declare localJsxFactory?: EntityName | undefined; - declare localJsxFragmentFactory?: EntityName | undefined; - declare exportedModulesFromDeclarationEmit?: ExportedModulesFromDeclarationEmit | undefined; - declare endFlowNode?: FlowNode | undefined; - declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare locals?: SymbolTable | undefined; - declare nextContainer?: HasLocals | undefined; - declare scriptSnapshot: IScriptSnapshot; - declare nameTable: UnderscoreEscapedMap | undefined; - - private declare namedDeclarations: Map | undefined; - - constructor(kind: SyntaxKind.SourceFile, pos: number, end: number) { - super(kind, pos, end); - } - - public update(newText: string, textChangeRange: TextChangeRange): SourceFile { - return updateSourceFile(this, newText, textChangeRange); - } - - public getLineAndCharacterOfPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); - } - - public getLineStarts(): readonly number[] { - return getLineStarts(this); - } - - public getPositionOfLineAndCharacter(line: number, character: number, allowEdits?: true): number { - return computePositionOfLineAndCharacter(getLineStarts(this), line, character, this.text, allowEdits); - } - - public getLineEndOfPosition(pos: number): number { - const { line } = this.getLineAndCharacterOfPosition(pos); - const lineStarts = this.getLineStarts(); - - let lastCharPos: number | undefined; - if (line + 1 >= lineStarts.length) { - lastCharPos = this.getEnd(); - } - if (!lastCharPos) { - lastCharPos = lineStarts[line + 1] - 1; - } - - const fullText = this.getFullText(); - // if the new line is "\r\n", we should return the last non-new-line-character position - return fullText[lastCharPos] === "\n" && fullText[lastCharPos - 1] === "\r" ? lastCharPos - 1 : lastCharPos; - } - - public getNamedDeclarations(): Map { - if (!this.namedDeclarations) { - this.namedDeclarations = this.computeNamedDeclarations(); - } - - return this.namedDeclarations; - } - - private computeNamedDeclarations(): Map { - const result = createMultiMap(); - - this.forEachChild(visit); - - return result; - - function addDeclaration(declaration: Declaration) { - const name = getDeclarationName(declaration); - if (name) { - result.add(name, declaration); - } - } - - function getDeclarations(name: string) { - let declarations = result.get(name); - if (!declarations) { - result.set(name, declarations = []); - } - return declarations; - } - - function getDeclarationName(declaration: Declaration) { - const name = getNonAssignedNameOfDeclaration(declaration); - return name && (isComputedPropertyName(name) && isPropertyAccessExpression(name.expression) ? name.expression.name.text - : isPropertyName(name) ? getNameFromPropertyName(name) : undefined); - } - - function visit(node: Node): void { - switch (node.kind) { - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - const functionDeclaration = node as FunctionLikeDeclaration; - const declarationName = getDeclarationName(functionDeclaration); - - if (declarationName) { - const declarations = getDeclarations(declarationName); - const lastDeclaration = lastOrUndefined(declarations); - - // Check whether this declaration belongs to an "overload group". - if (lastDeclaration && functionDeclaration.parent === lastDeclaration.parent && functionDeclaration.symbol === lastDeclaration.symbol) { - // Overwrite the last declaration if it was an overload - // and this one is an implementation. - if (functionDeclaration.body && !(lastDeclaration as FunctionLikeDeclaration).body) { - declarations[declarations.length - 1] = functionDeclaration; - } - } - else { - declarations.push(functionDeclaration); - } - } - forEachChild(node, visit); - break; - - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.TypeAliasDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - case SyntaxKind.ImportEqualsDeclaration: - case SyntaxKind.ExportSpecifier: - case SyntaxKind.ImportSpecifier: - case SyntaxKind.ImportClause: - case SyntaxKind.NamespaceImport: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.TypeLiteral: - addDeclaration(node as Declaration); - forEachChild(node, visit); - break; - - case SyntaxKind.Parameter: - // Only consider parameter properties - if (!hasSyntacticModifier(node, ModifierFlags.ParameterPropertyModifier)) { - break; - } - // falls through - - case SyntaxKind.VariableDeclaration: - case SyntaxKind.BindingElement: { - const decl = node as VariableDeclaration; - if (isBindingPattern(decl.name)) { - forEachChild(decl.name, visit); - break; - } - if (decl.initializer) { - visit(decl.initializer); - } - } - // falls through - case SyntaxKind.EnumMember: - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - addDeclaration(node as Declaration); - break; - - case SyntaxKind.ExportDeclaration: - // Handle named exports case e.g.: - // export {a, b as B} from "mod"; - const exportDeclaration = node as ExportDeclaration; - if (exportDeclaration.exportClause) { - if (isNamedExports(exportDeclaration.exportClause)) { - forEach(exportDeclaration.exportClause.elements, visit); - } - else { - visit(exportDeclaration.exportClause.name); - } - } - break; - - case SyntaxKind.ImportDeclaration: - const importClause = (node as ImportDeclaration).importClause; - if (importClause) { - // Handle default import case e.g.: - // import d from "mod"; - if (importClause.name) { - addDeclaration(importClause.name); - } - - // Handle named bindings in imports e.g.: - // import * as NS from "mod"; - // import {a, b as B} from "mod"; - if (importClause.namedBindings) { - if (importClause.namedBindings.kind === SyntaxKind.NamespaceImport) { - addDeclaration(importClause.namedBindings); - } - else { - forEach(importClause.namedBindings.elements, visit); - } - } - } - break; - - case SyntaxKind.BinaryExpression: - if (getAssignmentDeclarationKind(node as BinaryExpression) !== AssignmentDeclarationKind.None) { - addDeclaration(node as BinaryExpression); - } - // falls through - - default: - forEachChild(node, visit); - } - } - } - - static { this.prototype.kind = SyntaxKind.SourceFile; } - }; -} - - -// eslint-disable-next-line prefer-const -/** @internal */ -export const objectAllocator: ObjectAllocator = { - getNodeConstructor: () => NodeConstructors.Node as any, - getTokenConstructor: () => NodeConstructors.Token as any, - getIdentifierConstructor: () => NodeConstructors.Identifier as any, - getPrivateIdentifierConstructor: () => NodeConstructors.PrivateIdentifier as any, - getSourceFileConstructor: () => NodeConstructors.SourceFile as any, - getSymbolConstructor: () => Symbol as any, - getTypeConstructor: () => Type as any, - getSignatureConstructor: () => Signature as any, - getSourceMapSourceConstructor: () => SourceMapSource as any, -}; - -/** @internal */ -export function setObjectAllocator(alloc: ObjectAllocator) { - Object.assign(objectAllocator, alloc); -} - /** @internal */ export function formatStringFromArgs(text: string, args: ArrayLike, baseIndex = 0): string { return text.replace(/{(\d+)}/g, (_match, index: string) => "" + Debug.checkDefined(args[+index + baseIndex])); diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index caca5fc914394..76b96b955ecb1 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -1345,9 +1345,9 @@ export const createLogicalNot = deprecate(function createLogicalNot(operand: Exp /** @deprecated Use an appropriate `factory` method instead. */ export const createNode = deprecate(function createNode(kind: SyntaxKind, pos = 0, end = 0): Node { return setTextRangePosEnd( - kind === SyntaxKind.SourceFile ? parseBaseNodeFactory.createBaseSourceFileNode(kind) : - kind === SyntaxKind.Identifier ? parseBaseNodeFactory.createBaseIdentifierNode(kind) : - kind === SyntaxKind.PrivateIdentifier ? parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : + kind === SyntaxKind.SourceFile ? parseBaseNodeFactory.createBaseSourceFileNode() : + kind === SyntaxKind.Identifier ? parseBaseNodeFactory.createBaseIdentifierNode() : + kind === SyntaxKind.PrivateIdentifier ? parseBaseNodeFactory.createBasePrivateIdentifierNode() : !isNodeKind(kind) ? parseBaseNodeFactory.createBaseTokenNode(kind) : parseBaseNodeFactory.createBaseNode(kind), pos, diff --git a/src/services/services.ts b/src/services/services.ts index 3e0d572ef6486..419693dc061c9 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5,13 +5,13 @@ import { __String, ApplicableRefactorInfo, ApplyCodeActionCommandResult, - BaseType, BreakpointResolver, CallHierarchy, CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, CancellationToken, + canHaveJSDoc, changeCompilerHostLikeToUseCache, CharacterCodes, Classifications, @@ -36,6 +36,7 @@ import { createGetCanonicalFileName, createProgram, CreateProgramOptions, + createScanner, createSourceFile, CreateSourceFileOptions, createTextSpanFromBounds, @@ -59,9 +60,11 @@ import { EmitTextWriter, emptyArray, emptyOptions, + EndOfFileToken, equateValues, FileTextChanges, filter, + find, FindAllReferences, findChildOfKind, findPrecedingToken, @@ -86,13 +89,11 @@ import { getFileEmitOutput, getImpliedNodeFormatForFile, getJSDocTags, - getLineAndCharacterOfPosition, getMappedDocumentSpan, getNameFromPropertyName, getNewLineCharacter, getNewLineOrDefaultFromHost, getNormalizedAbsolutePath, - getObjectFlags, getScriptKind, getSetExternalModuleIndicator, getSnapshotText, @@ -104,20 +105,17 @@ import { hasJSDocNodes, hasProperty, hasStaticModifier, + hasTabstop, HighlightSpanKind, HostCancellationToken, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, identity, ImplementationLocation, - IndexKind, - IndexType, InlayHint, InlayHints, InlayHintsContext, insertSorted, - InterfaceType, - IntersectionType, isArray, isConstTypeReference, IScriptSnapshot, @@ -131,6 +129,7 @@ import { isInString, isInTemplateString, isIntrinsicJsxName, + isJSDocCommentContainingNode, isJsxAttributes, isJsxClosingElement, isJsxElement, @@ -143,6 +142,7 @@ import { isNamedTupleMember, isNameOfModuleDeclaration, isNewExpression, + isNodeKind, isObjectLiteralElement, isObjectLiteralExpression, isPrivateIdentifier, @@ -153,7 +153,7 @@ import { isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, - isThisTypeParameter, + isTokenKind, isTransientSymbol, JsDoc, JSDocTagInfo, @@ -166,10 +166,10 @@ import { LanguageService, LanguageServiceHost, LanguageServiceMode, + lastOrUndefined, length, LineAndCharacter, lineBreakPart, - LiteralType, map, mapDefined, MapLike, @@ -177,18 +177,18 @@ import { maybeBind, maybeSetLocalizedDiagnosticMessages, ModuleDeclaration, + Mutable, NavigateToItem, NavigationBarItem, NavigationTree, Node, + NodeArray, NodeConstructors, NodeFlags, noop, normalizePath, - NumberLiteralType, NumericLiteral, - ObjectAllocator, - ObjectFlags, + ObjectConstructors, ObjectLiteralElement, ObjectLiteralExpression, OperationCanceledException, @@ -204,6 +204,7 @@ import { PossibleProgramFileInfo, Program, PropertyName, + Push, QuickInfo, refactor, RefactorContext, @@ -223,28 +224,22 @@ import { ScriptTarget, SelectionRange, SemanticClassificationFormat, - setObjectAllocator, Signature, - SignatureDeclaration, - SignatureFlags, SignatureHelp, SignatureHelpItems, SignatureHelpItemsOptions, - SignatureKind, singleElementArray, SmartSelectionRange, SortedArray, SourceFile, - SourceMapSource, + SourceFileLike, stringContains, StringLiteralLike, - StringLiteralType, Symbol, SymbolDisplay, SymbolDisplayPart, - SymbolFlags, - symbolName, SyntaxKind, + SyntaxList, tagNamesAreEquivalent, TextChange, TextChangeRange, @@ -255,18 +250,14 @@ import { timestamp, TodoComment, TodoCommentDescriptor, + Token, toPath, tracing, + TransientSymbol, Type, TypeChecker, - TypeFlags, - TypeParameter, - TypePredicate, - TypeReference, typeToDisplayParts, UnderscoreEscapedMap, - UnionOrIntersectionType, - UnionType, updateSourceFile, UserPreferences, } from "./_namespaces/ts"; @@ -274,270 +265,261 @@ import { /** The version of the language service API */ export const servicesVersion = "0.8"; -class SymbolObject implements Symbol { - flags: SymbolFlags; - escapedName: __String; - declarations!: Declaration[]; - valueDeclaration!: Declaration; - id = 0; - mergeId = 0; - constEnumOnlyModule: boolean | undefined; +const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); - // Undefined is used to indicate the value has not been computed. If, after computing, the - // symbol has no doc comment, then the empty array will be returned. - documentationComment?: SymbolDisplayPart[]; - tags?: JSDocTagInfo[]; // same - - contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; - contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; - - contextualGetAccessorTags?: JSDocTagInfo[]; - contextualSetAccessorTags?: JSDocTagInfo[]; - - constructor(flags: SymbolFlags, name: __String) { - this.flags = flags; - this.escapedName = name; +function createChildren(node: Node, sourceFile: SourceFileLike | undefined): Node[] { + if (!isNodeKind(node.kind)) { + return emptyArray; } - getFlags(): SymbolFlags { - return this.flags; - } + const children: Node[] = []; - get name(): string { - return symbolName(this); - } - - getEscapedName(): __String { - return this.escapedName; + if (isJSDocCommentContainingNode(node)) { + /** Don't add trivia for "tokens" since this is in a comment. */ + node.forEachChild(child => { + children.push(child); + }); + return children; } - getName(): string { - return this.name; - } + scanner.setText((sourceFile || node.getSourceFile()).text); + let pos = node.pos; + const processNode = (child: Node) => { + addSyntheticNodes(children, pos, child.pos, node); + children.push(child); + pos = child.end; + }; + const processNodes = (nodes: NodeArray) => { + addSyntheticNodes(children, pos, nodes.pos, node); + children.push(createSyntaxList(nodes, node)); + pos = nodes.end; + }; - getDeclarations(): Declaration[] | undefined { - return this.declarations; + // jsDocComments need to be the first children + if (canHaveJSDoc(node)) { + forEach(node.jsDoc, processNode); } - getDocumentationComment(checker: TypeChecker | undefined): SymbolDisplayPart[] { - if (!this.documentationComment) { - this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs - - if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) { - const labelDecl = this.links.target.links.tupleLabelDeclaration; - this.documentationComment = getDocumentationComment([labelDecl], checker); - } - else { - this.documentationComment = getDocumentationComment(this.declarations, checker); - } - } - return this.documentationComment; - } + // For syntactic classifications, all trivia are classified together, including jsdoc comments. + // For that to work, the jsdoc comments should still be the leading trivia of the first child. + // Restoring the scanner position ensures that. + pos = node.pos; + node.forEachChild(processNode, processNodes); + addSyntheticNodes(children, pos, node.end, node); + scanner.setText(undefined); + return children; +} - getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { - if (context) { - if (isGetAccessor(context)) { - if (!this.contextualGetAccessorDocumentationComment) { - this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker); - } - if (length(this.contextualGetAccessorDocumentationComment)) { - return this.contextualGetAccessorDocumentationComment; - } - } - if (isSetAccessor(context)) { - if (!this.contextualSetAccessorDocumentationComment) { - this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker); - } - if (length(this.contextualSetAccessorDocumentationComment)) { - return this.contextualSetAccessorDocumentationComment; +function addSyntheticNodes(nodes: Push, pos: number, end: number, parent: Node): void { + scanner.setTextPos(pos); + while (pos < end) { + const kind = scanner.scan(); + const textPos = scanner.getTextPos(); + if (textPos <= end) { + if (kind === SyntaxKind.Identifier) { + if (hasTabstop(parent)) { + continue; } + Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); } + Debug.assert(isTokenKind(kind)); + const token = new NodeConstructors.TokenObject(kind) as any as Mutable>; + token.pos = pos; + token.end = textPos; + token.parent = parent; + token.flags = parent.flags & NodeFlags.ContextFlags; + nodes.push(token); + } + pos = textPos; + if (kind === SyntaxKind.EndOfFileToken) { + break; } - return this.getDocumentationComment(checker); } +} - getJsDocTags(checker?: TypeChecker): JSDocTagInfo[] { - if (this.tags === undefined) { - this.tags = getJsDocTagsOfDeclarations(this.declarations, checker); - } - - return this.tags; - } +function createSyntaxList(nodes: NodeArray, parent: Node): Node { + const list = new NodeConstructors.NodeObject(SyntaxKind.SyntaxList) as Node as Mutable; + list.pos = nodes.pos; + list.end = nodes.end; + list.parent = parent; + list.flags = parent.flags & NodeFlags.ContextFlags; + + list._children = []; + let pos = nodes.pos; + for (const node of nodes) { + addSyntheticNodes(list._children, pos, node.pos, parent); + list._children.push(node); + pos = node.end; + } + addSyntheticNodes(list._children, pos, nodes.end, parent); + return list; +} - getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { - if (context) { - if (isGetAccessor(context)) { - if (!this.contextualGetAccessorTags) { - this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); - } - if (length(this.contextualGetAccessorTags)) { - return this.contextualGetAccessorTags; - } - } - if (isSetAccessor(context)) { - if (!this.contextualSetAccessorTags) { - this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); - } - if (length(this.contextualSetAccessorTags)) { - return this.contextualSetAccessorTags; - } - } - } - return this.getJsDocTags(checker); - } +interface NodeInternals { + _children: Node[] | undefined; + assertHasRealPosition(message?: string): void; } -class TypeObject implements Type { - checker: TypeChecker; - flags: TypeFlags; - objectFlags?: ObjectFlags; - id!: number; - symbol!: Symbol; - constructor(checker: TypeChecker, flags: TypeFlags) { - this.checker = checker; - this.flags = flags; - } - getFlags(): TypeFlags { - return this.flags; - } - getSymbol(): Symbol | undefined { - return this.symbol; - } - getProperties(): Symbol[] { - return this.checker.getPropertiesOfType(this); - } - getProperty(propertyName: string): Symbol | undefined { - return this.checker.getPropertyOfType(this, propertyName); - } - getApparentProperties(): Symbol[] { - return this.checker.getAugmentedPropertiesOfType(this); - } - getCallSignatures(): readonly Signature[] { - return this.checker.getSignaturesOfType(this, SignatureKind.Call); - } - getConstructSignatures(): readonly Signature[] { - return this.checker.getSignaturesOfType(this, SignatureKind.Construct); - } - getStringIndexType(): Type | undefined { - return this.checker.getIndexTypeOfType(this, IndexKind.String); - } - getNumberIndexType(): Type | undefined { - return this.checker.getIndexTypeOfType(this, IndexKind.Number); - } - getBaseTypes(): BaseType[] | undefined { - return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; - } - isNullableType(): boolean { - return this.checker.isNullableType(this); - } - getNonNullableType(): Type { - return this.checker.getNonNullableType(this); - } - getNonOptionalType(): Type { - return this.checker.getNonOptionalType(this); - } - getConstraint(): Type | undefined { - return this.checker.getBaseConstraintOfType(this); - } - getDefault(): Type | undefined { - return this.checker.getDefaultFromTypeParameter(this); - } +NodeConstructors.NodeObject.prototype.getChildCount = function (this: Node & NodeInternals, sourceFile?: SourceFile) { + return this.getChildren(sourceFile).length; +}; - isUnion(): this is UnionType { - return !!(this.flags & TypeFlags.Union); - } - isIntersection(): this is IntersectionType { - return !!(this.flags & TypeFlags.Intersection); - } - isUnionOrIntersection(): this is UnionOrIntersectionType { - return !!(this.flags & TypeFlags.UnionOrIntersection); - } - isLiteral(): this is LiteralType { - return !!(this.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.BigIntLiteral)); - } - isStringLiteral(): this is StringLiteralType { - return !!(this.flags & TypeFlags.StringLiteral); - } - isNumberLiteral(): this is NumberLiteralType { - return !!(this.flags & TypeFlags.NumberLiteral); - } - isTypeParameter(): this is TypeParameter { - return !!(this.flags & TypeFlags.TypeParameter); - } - isClassOrInterface(): this is InterfaceType { - return !!(getObjectFlags(this) & ObjectFlags.ClassOrInterface); - } - isClass(): this is InterfaceType { - return !!(getObjectFlags(this) & ObjectFlags.Class); - } - isIndexType(): this is IndexType { - return !!(this.flags & TypeFlags.Index); +NodeConstructors.NodeObject.prototype.getChildAt = function (this: Node & NodeInternals, index: number, sourceFile?: SourceFile) { + return this.getChildren(sourceFile)[index]; +}; + +NodeConstructors.NodeObject.prototype.getChildren = function (this: Node & NodeInternals, sourceFile?: SourceFileLike) { + this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); + return this._children || (this._children = createChildren(this, sourceFile)); +}; + +NodeConstructors.NodeObject.prototype.getFirstToken = function (this: Node & NodeInternals, sourceFile?: SourceFileLike): Node | undefined { + this.assertHasRealPosition(); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; } - /** - * This polyfills `referenceType.typeArguments` for API consumers - */ - get typeArguments() { - if (getObjectFlags(this) & ObjectFlags.Reference) { - return this.checker.getTypeArguments(this as Type as TypeReference); - } + + const child = find(children, kid => kid.kind < SyntaxKind.FirstJSDocNode || kid.kind > SyntaxKind.LastJSDocNode)!; + return child.kind < SyntaxKind.FirstNode ? + child : + child.getFirstToken(sourceFile); +}; + +NodeConstructors.NodeObject.prototype.getLastToken = function (this: Node & NodeInternals, sourceFile?: SourceFileLike): Node | undefined { + this.assertHasRealPosition(); + const children = this.getChildren(sourceFile); + + const child = lastOrUndefined(children); + if (!child) { return undefined; } -} -class SignatureObject implements Signature { - flags: SignatureFlags; - checker: TypeChecker; - declaration!: SignatureDeclaration; - typeParameters?: TypeParameter[]; - parameters!: Symbol[]; - thisParameter!: Symbol; - resolvedReturnType!: Type; - resolvedTypePredicate: TypePredicate | undefined; - minTypeArgumentCount!: number; - minArgumentCount!: number; + return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); +}; + +for (const ctor of [ + NodeConstructors.TokenObject, + NodeConstructors.IdentifierObject, + NodeConstructors.PrivateIdentifierObject, +]) { + ctor.prototype.getChildCount = function (this: Node & NodeInternals, sourceFile?: SourceFile) { + return this.getChildren(sourceFile).length; + }; + + ctor.prototype.getChildAt = function (this: Node & NodeInternals, index: number, sourceFile?: SourceFile) { + return this.getChildren(sourceFile)[index]; + }; + + ctor.prototype.getChildren = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike) { + return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc || emptyArray : emptyArray; + }; + + ctor.prototype.getFirstToken = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike): Node | undefined { + return undefined; + }; + ctor.prototype.getLastToken = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike): Node | undefined { + return undefined; + }; +} + +// Patch Symbol for use with services. +interface SymbolInternals { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; - jsDocTags?: JSDocTagInfo[]; // same + tags?: JSDocTagInfo[]; // same - constructor(checker: TypeChecker, flags: SignatureFlags) { - this.checker = checker; - this.flags = flags; - } + contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; + contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; - getDeclaration(): SignatureDeclaration { - return this.declaration; - } - getTypeParameters(): TypeParameter[] | undefined { - return this.typeParameters; - } - getParameters(): Symbol[] { - return this.parameters; - } - getReturnType(): Type { - return this.checker.getReturnTypeOfSignature(this); + contextualGetAccessorTags?: JSDocTagInfo[]; + contextualSetAccessorTags?: JSDocTagInfo[]; +} + +ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: (Symbol | TransientSymbol) & SymbolInternals, checker: TypeChecker | undefined): SymbolDisplayPart[] { + if (!this.documentationComment) { + this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs + + if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) { + const labelDecl = this.links.target.links.tupleLabelDeclaration; + this.documentationComment = getDocumentationComment([labelDecl], checker); + } + else { + this.documentationComment = getDocumentationComment(this.declarations, checker); + } } - getTypeParameterAtPosition(pos: number): Type { - const type = this.checker.getParameterType(this, pos); - if (type.isIndexType() && isThisTypeParameter(type.type)) { - const constraint = type.type.getConstraint(); - if (constraint) { - return this.checker.getIndexType(constraint); + return this.documentationComment; +}; + +ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { + if (context) { + if (isGetAccessor(context)) { + if (!this.contextualGetAccessorDocumentationComment) { + this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker); + } + if (length(this.contextualGetAccessorDocumentationComment)) { + return this.contextualGetAccessorDocumentationComment; + } + } + if (isSetAccessor(context)) { + if (!this.contextualSetAccessorDocumentationComment) { + this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker); + } + if (length(this.contextualSetAccessorDocumentationComment)) { + return this.contextualSetAccessorDocumentationComment; } } - return type; } + return this.getDocumentationComment(checker); +}; - getDocumentationComment(): SymbolDisplayPart[] { - return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker)); +ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol & SymbolInternals, checker?: TypeChecker): JSDocTagInfo[] { + if (this.tags === undefined) { + this.tags = getJsDocTagsOfDeclarations(this.declarations, checker); } - getJsDocTags(): JSDocTagInfo[] { - return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker)); + return this.tags; +}; + +ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { + if (context) { + if (isGetAccessor(context)) { + if (!this.contextualGetAccessorTags) { + this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); + } + if (length(this.contextualGetAccessorTags)) { + return this.contextualGetAccessorTags; + } + } + if (isSetAccessor(context)) { + if (!this.contextualSetAccessorTags) { + this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); + } + if (length(this.contextualSetAccessorTags)) { + return this.contextualSetAccessorTags; + } + } } + return this.getJsDocTags(checker); +}; + +interface SignatureInternals { + // Undefined is used to indicate the value has not been computed. If, after computing, the + // symbol has no doc comment, then the empty array will be returned. + documentationComment?: SymbolDisplayPart[]; + jsDocTags?: JSDocTagInfo[]; // same } +ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature & SignatureInternals): SymbolDisplayPart[] { + return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker)); +}; + +ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature & SignatureInternals): JSDocTagInfo[] { + return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker)); +}; + /** * Returns whether or not the given node has a JSDoc "inheritDoc" tag on it. * @param node the Node in question. @@ -607,29 +589,6 @@ function findBaseOfDeclaration(checker: TypeChecker, declaration: Declaration }); } -class SourceMapSourceObject implements SourceMapSource { - lineMap!: number[]; - constructor(public fileName: string, public text: string, public skipTrivia?: (pos: number) => number) { } - - public getLineAndCharacterOfPosition(pos: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, pos); - } -} - -function getServicesObjectAllocator(): ObjectAllocator { - return { - getNodeConstructor: () => NodeConstructors.Node, - getTokenConstructor: () => NodeConstructors.Token, - getIdentifierConstructor: () => NodeConstructors.Identifier, - getPrivateIdentifierConstructor: () => NodeConstructors.PrivateIdentifier, - getSourceFileConstructor: () => NodeConstructors.SourceFile, - getSymbolConstructor: () => SymbolObject, - getTypeConstructor: () => TypeObject, - getSignatureConstructor: () => SignatureObject, - getSourceMapSourceConstructor: () => SourceMapSourceObject, - }; -} - /// Language Service /** @internal */ @@ -2576,5 +2535,3 @@ export function getDefaultLibFilePath(options: CompilerOptions): string { throw new Error("getDefaultLibFilePath is only supported when consumed as a node module. "); } - -setObjectAllocator(getServicesObjectAllocator()); diff --git a/src/services/types.ts b/src/services/types.ts index ce59f00615bba..43a8d8874e040 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -42,6 +42,63 @@ import { UserPreferences, } from "./_namespaces/ts"; +declare module "../compiler/types" { + /** + * A registry of forward references declared in the 'services' project. + * @internal + */ + export interface ServicesForwardRefs { + __services: true; + + SymbolDisplayPart: SymbolDisplayPart; + JSDocTagInfo: JSDocTagInfo; + } +} + +declare module "../compiler/types" { + // Module transform: converted from interface augmentation + export interface Node { + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): Node[]; + /** @internal */ + getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures + getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + /** @internal */ + getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFileLike): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + getLastToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + // See ts.forEachChild for documentation. + forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; + } +} + +declare module "../compiler/types" { + // Module transform: converted from interface augmentation + export interface Identifier { + readonly text: string; + } +} + +declare module "../compiler/types" { + // Module transform: converted from interface augmentation + export interface PrivateIdentifier { + readonly text: string; + } +} + declare module "../compiler/types" { // Module transform: converted from interface augmentation export interface Symbol { @@ -101,9 +158,9 @@ declare module "../compiler/types" { declare module "../compiler/types" { // Module transform: converted from interface augmentation export interface Signature { - getDeclaration(): SignatureDeclaration; - getTypeParameters(): TypeParameter[] | undefined; - getParameters(): Symbol[]; + getDeclaration(): JSDocSignature | SignatureDeclaration; + getTypeParameters(): readonly TypeParameter[] | undefined; + getParameters(): readonly Symbol[]; getTypeParameterAtPosition(pos: number): Type; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; @@ -111,6 +168,25 @@ declare module "../compiler/types" { } } +declare module "../compiler/types" { + // Module transform: converted from interface augmentation + export interface SourceFile { + /** @internal */ version: string; + /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; + /** @internal */ nameTable: UnderscoreEscapedMap | undefined; + + /** @internal */ getNamedDeclarations(): Map; + + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; + getLineStarts(): readonly number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + + /** @internal */ sourceMapper?: DocumentPositionMapper; + } +} + declare module "../compiler/types" { // Module transform: converted from interface augmentation export interface SourceFileLike { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json index dca1bc102db2a..1719888c52ee3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 8, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -25,7 +24,6 @@ "kind": "Identifier", "pos": 14, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ThisKeyword", "escapedText": "this" diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index e2e61c90da836..3c8c7deed7ca5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -24,7 +24,6 @@ "kind": "Identifier", "pos": 14, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "first" }, @@ -48,7 +47,6 @@ "kind": "Identifier", "pos": 39, "end": 43, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "link" }, @@ -79,7 +77,6 @@ "kind": "Identifier", "pos": 60, "end": 65, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -108,7 +105,6 @@ "kind": "Identifier", "pos": 86, "end": 87, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "A" }, @@ -116,7 +112,6 @@ "kind": "Identifier", "pos": 88, "end": 97, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Reference" } @@ -133,7 +128,6 @@ "kind": "Identifier", "pos": 66, "end": 69, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, @@ -150,7 +144,6 @@ "kind": "Identifier", "pos": 103, "end": 108, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -173,7 +166,6 @@ "kind": "Identifier", "pos": 127, "end": 131, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "http" }, @@ -203,7 +195,6 @@ "kind": "Identifier", "pos": 163, "end": 173, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Standalone" }, @@ -211,7 +202,6 @@ "kind": "Identifier", "pos": 174, "end": 181, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Complex" } @@ -252,7 +242,6 @@ "kind": "Identifier", "pos": 252, "end": 259, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "doubled" }, @@ -282,7 +271,6 @@ "kind": "Identifier", "pos": 333, "end": 335, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "oh" }, @@ -290,7 +278,6 @@ "kind": "Identifier", "pos": 336, "end": 338, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "no" } @@ -315,7 +302,6 @@ "kind": "Identifier", "pos": 376, "end": 381, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "https" }, @@ -355,7 +341,6 @@ "kind": "Identifier", "pos": 109, "end": 112, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "bar" }, @@ -372,7 +357,6 @@ "kind": "Identifier", "pos": 590, "end": 596, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -403,7 +387,6 @@ "kind": "Identifier", "pos": 650, "end": 655, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "https" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json index 9071bbe9d1a92..63235aa838560 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 4, "end": 5, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 7, "end": 8, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "b" } @@ -46,7 +44,6 @@ "kind": "Identifier", "pos": 10, "end": 11, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "c" } @@ -61,7 +58,6 @@ "kind": "Identifier", "pos": 12, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "d" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 712b12f402b6f..841f9518ce91b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 7, "end": 12, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -44,7 +43,6 @@ "kind": "Identifier", "pos": 35, "end": 40, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -59,7 +57,6 @@ "kind": "StringKeyword", "pos": 42, "end": 48, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -73,7 +70,6 @@ "kind": "Identifier", "pos": 50, "end": 51, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "o" }, @@ -81,7 +77,6 @@ "kind": "Identifier", "pos": 52, "end": 53, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "f" } @@ -102,7 +97,6 @@ "kind": "Identifier", "pos": 22, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "o" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 325eb9d10bc50..43a7e2c42cea4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 12, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "arg" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 14, "end": 20, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 22, "end": 27, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 947d5dfe8e8ad..ea59b9c0597a4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "argument" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 19, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 27, "end": 32, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 92772eb12d132..535a5d4eda7e1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 8, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -46,7 +45,6 @@ "kind": "Identifier", "pos": 51, "end": 57, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -62,7 +60,6 @@ "kind": "Identifier", "pos": 113, "end": 119, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -78,7 +75,6 @@ "kind": "Identifier", "pos": 171, "end": 177, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -108,7 +104,6 @@ "kind": "Identifier", "pos": 228, "end": 234, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -138,7 +133,6 @@ "kind": "Identifier", "pos": 273, "end": 279, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -154,7 +148,6 @@ "kind": "Identifier", "pos": 339, "end": 345, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -184,7 +177,6 @@ "kind": "Identifier", "pos": 382, "end": 388, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -214,7 +206,6 @@ "kind": "Identifier", "pos": 399, "end": 405, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -244,7 +235,6 @@ "kind": "Identifier", "pos": 430, "end": 436, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -274,7 +264,6 @@ "kind": "Identifier", "pos": 446, "end": 452, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -304,7 +293,6 @@ "kind": "Identifier", "pos": 454, "end": 460, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -334,7 +322,6 @@ "kind": "Identifier", "pos": 462, "end": 468, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -364,7 +351,6 @@ "kind": "Identifier", "pos": 487, "end": 493, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -394,7 +380,6 @@ "kind": "Identifier", "pos": 498, "end": 504, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -424,7 +409,6 @@ "kind": "Identifier", "pos": 523, "end": 529, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -454,7 +438,6 @@ "kind": "Identifier", "pos": 560, "end": 566, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, @@ -470,7 +453,6 @@ "kind": "Identifier", "pos": 600, "end": 607, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "address" }, @@ -486,7 +468,6 @@ "kind": "Identifier", "pos": 647, "end": 653, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "author" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index ebc0cbe69b388..33f14ebd36287 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 8, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "example" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json index f2bd46a399511..8793504cc40a5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "exception" }, @@ -36,7 +35,6 @@ "kind": "Identifier", "pos": 20, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Error" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json index 457ee3d3564fe..0226b44843ac7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "exception" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json index cfc0f066b9894..a13a8a64c3548 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "exception" }, @@ -37,7 +36,6 @@ "kind": "Identifier", "pos": 20, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Error" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json index 8d57b3d79ab77..610a355bd6599 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "TypeKeyword", "escapedText": "type" @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 15, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 2112acfb91c23..a78806d2b35f3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 8, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -25,7 +24,6 @@ "kind": "Identifier", "pos": 14, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "x" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json index 64de20d9bef39..a40076870c680 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 8, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -25,7 +24,6 @@ "kind": "Identifier", "pos": 14, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ThisKeyword", "escapedText": "this" @@ -43,7 +41,6 @@ "kind": "Identifier", "pos": 30, "end": 35, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -52,7 +49,6 @@ "kind": "Identifier", "pos": 36, "end": 40, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "fine" }, @@ -69,7 +65,6 @@ "kind": "Identifier", "pos": 51, "end": 60, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "zerowidth" } @@ -84,7 +79,6 @@ "kind": "Identifier", "pos": 63, "end": 73, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "singlestar" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json index 8d57b3d79ab77..610a355bd6599 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "TypeKeyword", "escapedText": "type" @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 15, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json index ad2eea3f2d5c3..a1ae87a05566e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ReturnKeyword", "escapedText": "return" diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json index cf333fe962a17..25d525efd7f8a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -30,7 +29,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -38,7 +36,6 @@ "kind": "Identifier", "pos": 24, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 87a7257d93202..734e99b221f30 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 24, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 78e4224ea83e2..8a9e7fb352a3f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 25, "end": 30, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index e2fb8a207a2a9..020b0d9437b72 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 26, "end": 31, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json index 02e2fe9f1462d..a4ae7884303dc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -30,7 +29,6 @@ "kind": "NumberKeyword", "pos": 22, "end": 28, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -38,7 +36,6 @@ "kind": "Identifier", "pos": 15, "end": 20, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 4abe5fbe0a068..29ed1f1a29aba 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 22, "end": 28, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -39,7 +37,6 @@ "kind": "Identifier", "pos": 15, "end": 20, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json index f273ca6e439dc..132a4ef44e978 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -24,7 +23,6 @@ "kind": "Identifier", "pos": 15, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json index 00e574a12c499..0c684e88bb06e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ReturnKeyword", "escapedText": "return" @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 17, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index 7fb31fbd96d6a..68861d2744d17 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ReturnKeyword", "escapedText": "return" @@ -32,7 +31,6 @@ "kind": "NumberKeyword", "pos": 17, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json index 12b1a7ffbacbd..b405df418d610 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 16, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "returns" }, @@ -30,7 +29,6 @@ "kind": "NumberKeyword", "pos": 18, "end": 24, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json index 46d293346c344..468ab95cf8113 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "T" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json index 47a2e48d7b430..814468541c5d4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "K" } @@ -46,7 +44,6 @@ "kind": "Identifier", "pos": 20, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "V" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json index e2d1488825d0a..c8d415e13ed27 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "K" } @@ -46,7 +44,6 @@ "kind": "Identifier", "pos": 21, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "V" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json index e2d1488825d0a..c8d415e13ed27 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "K" } @@ -46,7 +44,6 @@ "kind": "Identifier", "pos": 21, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "V" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json index b05a2188fe1d9..516c270f81ae7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -31,7 +30,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "K" } @@ -46,7 +44,6 @@ "kind": "Identifier", "pos": 22, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "V" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index fd6f6cfa39916..754b96d70281d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 17, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "template" }, @@ -32,7 +31,6 @@ "kind": "Identifier", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "K" } @@ -47,7 +45,6 @@ "kind": "Identifier", "pos": 22, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "V" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json index b5ba5725d70dc..f1e04949611cd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "throws" }, @@ -36,7 +35,6 @@ "kind": "Identifier", "pos": 17, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Error" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json index 5f43e718a9220..c57a789553db3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "throws" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json index 2d48630897e6e..dc6e605dc95b1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 15, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "throws" }, @@ -37,7 +36,6 @@ "kind": "Identifier", "pos": 17, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "Error" } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json index 9b74cfdcf18d5..bb16558e5f9e6 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -30,7 +29,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -38,7 +36,6 @@ "kind": "Identifier", "pos": 24, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, @@ -55,7 +52,6 @@ "kind": "Identifier", "pos": 35, "end": 40, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -69,7 +65,6 @@ "kind": "NumberKeyword", "pos": 42, "end": 48, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -77,7 +72,6 @@ "kind": "Identifier", "pos": 50, "end": 55, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name2" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json index 6ad815ea17fe4..a3b5ddaca61cc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 14, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -30,7 +29,6 @@ "kind": "NumberKeyword", "pos": 16, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -38,7 +36,6 @@ "kind": "Identifier", "pos": 24, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name1" }, @@ -55,7 +52,6 @@ "kind": "Identifier", "pos": 31, "end": 36, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "param" }, @@ -69,7 +65,6 @@ "kind": "NumberKeyword", "pos": 38, "end": 44, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -77,7 +72,6 @@ "kind": "Identifier", "pos": 46, "end": 51, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name2" }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json index 8d57b3d79ab77..610a355bd6599 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "TypeKeyword", "escapedText": "type" @@ -31,7 +30,6 @@ "kind": "NumberKeyword", "pos": 15, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 1 } } diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json index 616f1afa7c41d..dff2bb63fa7c4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json @@ -16,7 +16,6 @@ "kind": "Identifier", "pos": 9, "end": 16, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "typedef" }, @@ -37,7 +36,6 @@ "kind": "Identifier", "pos": 48, "end": 56, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "property" }, @@ -51,7 +49,6 @@ "kind": "NumberKeyword", "pos": 58, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -59,7 +56,6 @@ "kind": "Identifier", "pos": 66, "end": 69, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "age" }, @@ -76,7 +72,6 @@ "kind": "Identifier", "pos": 75, "end": 83, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "property" }, @@ -90,7 +85,6 @@ "kind": "StringKeyword", "pos": 85, "end": 91, - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -98,7 +92,6 @@ "kind": "Identifier", "pos": 93, "end": 97, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "name" }, @@ -117,7 +110,6 @@ "kind": "Identifier", "pos": 17, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "People" }, @@ -125,7 +117,6 @@ "kind": "Identifier", "pos": 17, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "People" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json index 1495118eb01fa..4b4f64ff69668 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json @@ -17,7 +17,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json index ec1b762ec8ae4..c88cf10efeacc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json @@ -24,7 +24,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json index 9ff034ed0c206..e723a54556955 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json @@ -38,7 +38,6 @@ "pos": 2, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json index af72564535911..edc12f8f0b791 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json @@ -25,7 +25,6 @@ "pos": 5, "end": 12, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json index 1f19771399fbf..3ec8a590dcdeb 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json @@ -18,7 +18,6 @@ "pos": 10, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -34,7 +33,6 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json index 1f19771399fbf..3ec8a590dcdeb 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json @@ -18,7 +18,6 @@ "pos": 10, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -34,7 +33,6 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json index d9f2543b29fec..9ee95f4db14bc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json @@ -25,7 +25,6 @@ "pos": 10, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json index 4dbd3f2959bf8..57c8c6e2b758a 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json @@ -10,7 +10,6 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "VarKeyword", "escapedText": "var" diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json index 042e09174b62e..eaf113206ee58 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json @@ -10,7 +10,6 @@ "pos": 1, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword3.json index 13e057fbca4cf..f64319d2bba8b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword3.json @@ -3,6 +3,5 @@ "pos": 1, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json index 96f5614bbdb6d..2585696a6bf43 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, @@ -34,7 +33,6 @@ "pos": 8, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json index 070cfdabde5dd..ddbe5715183ff 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json @@ -18,7 +18,6 @@ "pos": 10, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "NewKeyword", "escapedText": "new" @@ -42,7 +41,6 @@ "pos": 14, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" }, @@ -51,7 +49,6 @@ "pos": 16, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "b" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json index 9f30835104500..0c26ec3833ddf 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json @@ -10,7 +10,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "postfix": false diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json index 0b4718e71ac93..b04300a23ad17 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json @@ -10,7 +10,6 @@ "pos": 1, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "postfix": true diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json index 17b7fa941ccf9..f8bf5398d90db 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json @@ -10,7 +10,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "postfix": false diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json index 76313b04a415c..f5a665639c52b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json @@ -10,7 +10,6 @@ "pos": 1, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "postfix": true diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json index 0d684a34ade97..292b0f4455123 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json @@ -10,7 +10,6 @@ "pos": 1, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json index 9399b03826ced..b861870f7086f 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json index 95f7490af76ec..557652828a4be 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, @@ -27,7 +26,6 @@ "pos": 6, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json index 9a9b15f5698c0..75977d52d6bb2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" } @@ -35,7 +34,6 @@ "pos": 6, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "bar" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json index 52c45d3efd7ff..00a156444e6c4 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, @@ -27,7 +26,6 @@ "pos": 6, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -43,7 +41,6 @@ "pos": 14, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "bar" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json index ecd6b5c14fb8f..4c1c1c15488d9 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" } @@ -35,7 +34,6 @@ "pos": 6, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "bar" }, @@ -44,7 +42,6 @@ "pos": 11, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json index 574f2c56badae..7d56586d4752d 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json @@ -18,7 +18,6 @@ "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "foo" }, @@ -27,7 +26,6 @@ "pos": 6, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, @@ -43,7 +41,6 @@ "pos": 14, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "bar" }, @@ -52,7 +49,6 @@ "pos": 19, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json index 780a7289bd51c..505c926ca3cf2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json @@ -18,7 +18,6 @@ "pos": 2, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "FunctionKeyword", "escapedText": "function" diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json index 2f189e79ae3a0..4cc83e52b4498 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json @@ -18,7 +18,6 @@ "pos": 10, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "ThisKeyword", "escapedText": "this" @@ -42,7 +41,6 @@ "pos": 15, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" }, @@ -51,7 +49,6 @@ "pos": 17, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "b" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json index cecca945f8766..89842c75b8732 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json @@ -11,7 +11,6 @@ "pos": 1, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -19,7 +18,6 @@ "pos": 8, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json index 1c70750268db7..12befdc648503 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json @@ -18,7 +18,6 @@ "pos": 2, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json index bcbe47b7f7e53..3470d4cd8ac7c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json @@ -17,7 +17,6 @@ "pos": 10, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json index 4308670e5c906..eeb1dc9dc1bac 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json @@ -17,7 +17,6 @@ "pos": 6, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json index cbc7c4e5fef27..3720475c1f498 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json @@ -11,7 +11,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json index 39cc53e916d14..91d44edea9e43 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json @@ -11,7 +11,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -19,7 +18,6 @@ "pos": 9, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json index 3ffaae428a0e6..de7e4268e2509 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json @@ -11,7 +11,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -19,7 +18,6 @@ "pos": 9, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "2": { @@ -27,7 +25,6 @@ "pos": 16, "end": 23, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 3, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json index 257d5ddf798f3..3da3449148ff0 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json @@ -11,7 +11,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json index 772888ef36f09..4c703947ea262 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json @@ -10,7 +10,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" }, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json index 2d1f6a9d97e31..a04f845079020 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json @@ -10,7 +10,6 @@ "pos": 7, "end": 9, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "M" } diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json index cfbef060a8516..51f64e48be6bc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json @@ -10,7 +10,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a", "jsdocDotPos": 2 @@ -21,7 +20,6 @@ "pos": 4, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json index 3802cb3212932..d849f0c8f2b23 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json @@ -10,7 +10,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a", "jsdocDotPos": 2 @@ -21,7 +20,6 @@ "pos": 4, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -29,7 +27,6 @@ "pos": 11, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json index 5dde38b4c0b07..e17b735e4121b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json @@ -17,7 +17,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "escapedText": "a" }, @@ -26,7 +25,6 @@ "pos": 3, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, "originalKeywordKind": "FunctionKeyword", "escapedText": "function" diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json index 0d340996e327c..93be2ef86cd5b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json @@ -18,7 +18,6 @@ "pos": 2, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -26,7 +25,6 @@ "pos": 9, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json index c41b696a22e4b..1238bc87c974d 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json @@ -18,7 +18,6 @@ "pos": 4, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "1": { @@ -26,7 +25,6 @@ "pos": 13, "end": 20, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json index bf89e3afe8bb3..d013dcf9fa55c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json @@ -18,7 +18,6 @@ "pos": 4, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 }, "length": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json index d162c5260553f..6ec84fc8faba2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json @@ -10,7 +10,6 @@ "pos": 4, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1 } } \ No newline at end of file diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index ab63f3b08db66..828d2b7825033 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6105,6 +6105,27 @@ declare namespace ts { getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; + /** Releases all resources held by this script snapshot */ + dispose?(): void; + } interface Bundle extends Node { readonly kind: SyntaxKind.Bundle; readonly prepends: readonly (InputFiles | UnparsedSource)[]; @@ -6887,9 +6908,9 @@ declare namespace ts { parameters: readonly Symbol[]; } interface Signature { - getDeclaration(): SignatureDeclaration; - getTypeParameters(): TypeParameter[] | undefined; - getParameters(): Symbol[]; + getDeclaration(): JSDocSignature | SignatureDeclaration; + getTypeParameters(): readonly TypeParameter[] | undefined; + getParameters(): readonly Symbol[]; getTypeParameterAtPosition(pos: number): Type; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; @@ -9836,27 +9857,6 @@ declare namespace ts { } type InvalidatedProject = UpdateOutputFileStampsProject | BuildInvalidedProject | UpdateBundleProject; function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings; - /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the - * snapshot is observably immutable. i.e. the same calls with the same parameters will return - * the same values. - */ - interface IScriptSnapshot { - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; - /** Gets the length of this script snapshot. */ - getLength(): number; - /** - * Gets the TextChangeRange that describe how the text changed between this text and - * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the - * change range cannot be determined. However, in that case, incremental parsing will - * not happen and the entire document will be re - parsed. - */ - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - /** Releases all resources held by this script snapshot */ - dispose?(): void; - } namespace ScriptSnapshot { function fromString(text: string): IScriptSnapshot; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 22bef5bbffdc0..0b1f8602342b1 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -2170,6 +2170,27 @@ declare namespace ts { getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } + /** + * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * snapshot is observably immutable. i.e. the same calls with the same parameters will return + * the same values. + */ + interface IScriptSnapshot { + /** Gets a portion of the script snapshot specified by [start, end). */ + getText(start: number, end: number): string; + /** Gets the length of this script snapshot. */ + getLength(): number; + /** + * Gets the TextChangeRange that describe how the text changed between this text and + * an older version. This information is used by the incremental parser to determine + * what sections of the script need to be re-parsed. 'undefined' can be returned if the + * change range cannot be determined. However, in that case, incremental parsing will + * not happen and the entire document will be re - parsed. + */ + getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; + /** Releases all resources held by this script snapshot */ + dispose?(): void; + } interface Bundle extends Node { readonly kind: SyntaxKind.Bundle; readonly prepends: readonly (InputFiles | UnparsedSource)[]; @@ -2952,9 +2973,9 @@ declare namespace ts { parameters: readonly Symbol[]; } interface Signature { - getDeclaration(): SignatureDeclaration; - getTypeParameters(): TypeParameter[] | undefined; - getParameters(): Symbol[]; + getDeclaration(): JSDocSignature | SignatureDeclaration; + getTypeParameters(): readonly TypeParameter[] | undefined; + getParameters(): readonly Symbol[]; getTypeParameterAtPosition(pos: number): Type; getReturnType(): Type; getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; @@ -5974,27 +5995,6 @@ declare namespace ts { } } function getDefaultFormatCodeSettings(newLineCharacter?: string): FormatCodeSettings; - /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the - * snapshot is observably immutable. i.e. the same calls with the same parameters will return - * the same values. - */ - interface IScriptSnapshot { - /** Gets a portion of the script snapshot specified by [start, end). */ - getText(start: number, end: number): string; - /** Gets the length of this script snapshot. */ - getLength(): number; - /** - * Gets the TextChangeRange that describe how the text changed between this text and - * an older version. This information is used by the incremental parser to determine - * what sections of the script need to be re-parsed. 'undefined' can be returned if the - * change range cannot be determined. However, in that case, incremental parsing will - * not happen and the entire document will be re - parsed. - */ - getChangeRange(oldSnapshot: IScriptSnapshot): TextChangeRange | undefined; - /** Releases all resources held by this script snapshot */ - dispose?(): void; - } namespace ScriptSnapshot { function fromString(text: string): IScriptSnapshot; } From c6ffac91c347778091c932ced4b96e8d0c9f16e4 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Sat, 17 Dec 2022 13:37:01 -0500 Subject: [PATCH 04/24] Remove baseNodeFactory --- .../_namespaces/ts.NodeConstructors.ts | 1 - .../_namespaces/ts.ObjectConstructors.ts | 1 - src/compiler/_namespaces/ts.ts | 13 ++-- src/compiler/factory/baseNodeFactory.ts | 54 -------------- src/compiler/factory/nodeFactory.ts | 70 +++++++++---------- src/compiler/nodeConstructors.ts | 2 +- src/compiler/parser.ts | 44 +++--------- src/compiler/types.ts | 2 - .../4.0/nodeFactoryTopLevelExports.ts | 12 ++-- src/services/textChanges.ts | 4 +- 10 files changed, 55 insertions(+), 148 deletions(-) delete mode 100644 src/compiler/_namespaces/ts.NodeConstructors.ts delete mode 100644 src/compiler/_namespaces/ts.ObjectConstructors.ts delete mode 100644 src/compiler/factory/baseNodeFactory.ts diff --git a/src/compiler/_namespaces/ts.NodeConstructors.ts b/src/compiler/_namespaces/ts.NodeConstructors.ts deleted file mode 100644 index 8c79d37ff27c2..0000000000000 --- a/src/compiler/_namespaces/ts.NodeConstructors.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "../nodeConstructors"; diff --git a/src/compiler/_namespaces/ts.ObjectConstructors.ts b/src/compiler/_namespaces/ts.ObjectConstructors.ts deleted file mode 100644 index a546cb6c55e3b..0000000000000 --- a/src/compiler/_namespaces/ts.ObjectConstructors.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "../objectConstructors"; diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index 791cdc7be5904..32bfc2051f7db 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -14,7 +14,6 @@ export * from "../diagnosticInformationMap.generated"; export * from "../scanner"; export * from "../utilitiesPublic"; export * from "../utilities"; -export * from "../factory/baseNodeFactory"; export * from "../factory/parenthesizerRules"; export * from "../factory/nodeConverters"; export * from "../factory/nodeFactory"; @@ -72,11 +71,7 @@ import * as moduleSpecifiers from "./ts.moduleSpecifiers"; export { moduleSpecifiers }; import * as performance from "./ts.performance"; export { performance }; -/** @internal */ -import * as NodeConstructors from "./ts.NodeConstructors"; -/** @internal */ -export { NodeConstructors }; -/** @internal */ -import * as ObjectConstructors from "./ts.ObjectConstructors"; -/** @internal */ -export { ObjectConstructors }; +/** @internal */ import * as NodeConstructors from "../nodeConstructors"; +/** @internal */ export { NodeConstructors }; +/** @internal */ import * as ObjectConstructors from "../objectConstructors"; +/** @internal */ export { ObjectConstructors }; diff --git a/src/compiler/factory/baseNodeFactory.ts b/src/compiler/factory/baseNodeFactory.ts deleted file mode 100644 index 6f690627eac67..0000000000000 --- a/src/compiler/factory/baseNodeFactory.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { IdentifierObject, NodeObject, PrivateIdentifierObject, SourceFileObject, TokenObject } from "../nodeConstructors"; -import { - Node, - SyntaxKind, -} from "../_namespaces/ts"; - -/** - * A `BaseNodeFactory` is an abstraction over an `ObjectAllocator` that handles caching `Node` constructors - * and allocating `Node` instances based on a set of predefined types. - * - * @internal - */ -export interface BaseNodeFactory { - createBaseSourceFileNode(): Node; - createBaseIdentifierNode(): Node; - createBasePrivateIdentifierNode(): Node; - createBaseTokenNode(kind: SyntaxKind): Node; - createBaseNode(kind: SyntaxKind): Node; -} - -/** - * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. - * - * @internal - */ -export function createBaseNodeFactory(): BaseNodeFactory { - return { - createBaseSourceFileNode, - createBaseIdentifierNode, - createBasePrivateIdentifierNode, - createBaseTokenNode, - createBaseNode - }; - - function createBaseSourceFileNode(): Node { - return new SourceFileObject(); - } - - function createBaseIdentifierNode(): Node { - return new IdentifierObject(); - } - - function createBasePrivateIdentifierNode(): Node { - return new PrivateIdentifierObject(); - } - - function createBaseTokenNode(kind: SyntaxKind): Node { - return new TokenObject(kind); - } - - function createBaseNode(kind: SyntaxKind): Node { - return new NodeObject(kind); - } -} diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 09fa4592c7599..23ed04d584486 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -17,7 +17,6 @@ import { AsteriskToken, AwaitExpression, AwaitKeyword, - BaseNodeFactory, BigIntLiteral, BinaryExpression, BinaryOperator, @@ -59,7 +58,6 @@ import { ConstructorTypeNode, ConstructSignatureDeclaration, ContinueStatement, - createBaseNodeFactory, createNodeConverters, createParenthesizerRules, createScanner, @@ -467,15 +465,15 @@ import { WithStatement, YieldExpression, } from "../_namespaces/ts"; -// import { -// Node as NodeObject, -// Identifier as IdentifierObject, -// PrivateIdentifier as PrivateIdentifierObject, -// Token as TokenObject, -// SourceFile as SourceFileObject, -// } from "../nodeConstructors"; import { - SourceMapSourceObject as SourceMapSourceObject, + IdentifierObject, + NodeObject, + PrivateIdentifierObject, + SourceFileObject, + TokenObject, +} from "../nodeConstructors"; +import { + SourceMapSourceObject, } from "../objectConstructors"; let nextAutoGenerateId = 0; @@ -491,6 +489,8 @@ export const enum NodeFactoryFlags { NoIndentationOnFreshPropertyAccess = 1 << 2, // Do not set an `original` pointer when updating a node. NoOriginalNode = 1 << 3, + // Mark nodes as synthetic + MarkSynthetic = 1 << 4, } const nodeFactoryPatchers: ((factory: NodeFactory) => void)[] = []; @@ -507,7 +507,8 @@ export function addNodeFactoryPatcher(fn: (factory: NodeFactory) => void) { * * @internal */ -export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNodeFactory): NodeFactory { +export function createNodeFactory(flags: NodeFactoryFlags): NodeFactory { + const markSynthetic = (flags & NodeFactoryFlags.MarkSynthetic) === NodeFactoryFlags.MarkSynthetic; const update = flags & NodeFactoryFlags.NoOriginalNode ? updateWithoutOriginal : updateWithOriginal; // Lazily load the parenthesizer, node converters, and some factory methods until they are used. @@ -531,7 +532,6 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, get converters() { return converters(); }, - baseFactory, flags, createNodeArray, createNumericLiteral, @@ -1074,7 +1074,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } function createBaseNode(kind: T["kind"]) { - return baseFactory.createBaseNode(kind) as Mutable; + const node = new NodeObject(kind) as Node as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; + return node; } function createBaseDeclaration(kind: T["kind"]) { @@ -1160,7 +1162,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // function createBaseIdentifier(escapedText: __String, originalKeywordKind: SyntaxKind | undefined) { - const node = baseFactory.createBaseIdentifierNode() as Mutable; + const node = new IdentifierObject() as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; node.originalKeywordKind = originalKeywordKind; node.escapedText = escapedText; node.autoGenerate = undefined; @@ -1257,7 +1260,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } function createBasePrivateIdentifier(escapedText: __String) { - const node = baseFactory.createBasePrivateIdentifierNode() as Mutable; + const node = new PrivateIdentifierObject() as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; node.escapedText = escapedText; node.autoGenerate = undefined; node.transformFlags |= TransformFlags.ContainsClassFields; @@ -1306,7 +1310,9 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode // function createBaseToken(kind: T["kind"]) { - return baseFactory.createBaseTokenNode(kind) as Mutable; + const node = new TokenObject(kind) as Node as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; + return node; } // @api @@ -6033,7 +6039,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode endOfFileToken: EndOfFileToken, flags: NodeFlags ) { - const node = baseFactory.createBaseSourceFileNode() as Mutable; + const node = new SourceFileObject() as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -6116,7 +6123,8 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode function cloneSourceFileWorker(source: SourceFile) { // TODO: This mechanism for cloning results in megamorphic property reads and writes. In future perf-related // work, we should consider switching explicit property assignments instead of using `for..in`. - const node = baseFactory.createBaseSourceFileNode() as Mutable; + const node = new SourceFileObject() as Mutable; + if (markSynthetic) node.flags |= NodeFlags.Synthesized; node.flags |= source.flags & ~NodeFlags.Synthesized; for (const p in source) { if (hasProperty(node, p) || !hasProperty(source, p)) { @@ -6452,11 +6460,12 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode } const clone = - !isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) as T : - baseFactory.createBaseNode(node.kind) as T; + !isNodeKind(node.kind) ? new TokenObject(node.kind) as Node as Mutable : + new NodeObject(node.kind) as Node as Mutable; - (clone as Mutable).flags |= (node.flags & ~NodeFlags.Synthesized); - (clone as Mutable).transformFlags = node.transformFlags; + if (markSynthetic) clone.flags |= NodeFlags.Synthesized; + clone.flags |= (node.flags & ~NodeFlags.Synthesized); + clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (const key in node) { @@ -7388,22 +7397,7 @@ export function getTransformFlagsSubtreeExclusions(kind: SyntaxKind) { } } -const baseFactory = createBaseNodeFactory(); - -function makeSynthetic(node: Node) { - (node as Mutable).flags |= NodeFlags.Synthesized; - return node; -} - -const syntheticFactory: BaseNodeFactory = { - createBaseSourceFileNode: () => makeSynthetic(baseFactory.createBaseSourceFileNode()), - createBaseIdentifierNode: () => makeSynthetic(baseFactory.createBaseIdentifierNode()), - createBasePrivateIdentifierNode: () => makeSynthetic(baseFactory.createBasePrivateIdentifierNode()), - createBaseTokenNode: kind => makeSynthetic(baseFactory.createBaseTokenNode(kind)), - createBaseNode: kind => makeSynthetic(baseFactory.createBaseNode(kind)), -}; - -export const factory = createNodeFactory(NodeFactoryFlags.NoIndentationOnFreshPropertyAccess, syntheticFactory); +export const factory = createNodeFactory(NodeFactoryFlags.NoIndentationOnFreshPropertyAccess | NodeFactoryFlags.MarkSynthetic); export function createUnparsedSourceFile(text: string): UnparsedSource; export function createUnparsedSourceFile(inputFile: InputFiles, type: "js" | "dts", stripInternal?: boolean): UnparsedSource; diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 30aa0eef6ebae..8eee1a07a006f 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -758,4 +758,4 @@ export class SourceFileObject extends NodeObject implements SourceFile { } static { this.prototype.kind = SyntaxKind.SourceFile; } -} \ No newline at end of file +} diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 857e4dbd7edcf..6a98253b3bcbd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1,4 +1,3 @@ -import { IdentifierObject, NodeObject, PrivateIdentifierObject, SourceFileObject, TokenObject } from "./nodeConstructors"; import * as ts from "./_namespaces/ts"; import { AccessorDeclaration, @@ -17,7 +16,6 @@ import { AsteriskToken, attachFileToDiagnostics, AwaitExpression, - BaseNodeFactory, BinaryExpression, BinaryOperatorToken, BindingElement, @@ -401,21 +399,8 @@ const enum SpeculationKind { Reparse } -/** - * NOTE: You should not use this, it is only exported to support `createNode` in `~/src/deprecatedCompat/deprecations.ts`. - * - * @internal - */ -export const parseBaseNodeFactory: BaseNodeFactory = { - createBaseSourceFileNode: () => new SourceFileObject(), - createBaseIdentifierNode: () => new IdentifierObject(), - createBasePrivateIdentifierNode: () => new PrivateIdentifierObject(), - createBaseTokenNode: kind => new TokenObject(kind), - createBaseNode: kind => new NodeObject(kind), -}; - /** @internal */ -export const parseNodeFactory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules, parseBaseNodeFactory); +export const parseNodeFactory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules); function visitNode(cbNode: (node: Node) => T, node: Node | undefined): T | undefined { return node && cbNode(node); @@ -1410,22 +1395,7 @@ namespace Parser { const disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext; - function countNode(node: Node) { - nodeCount++; - return node; - } - - // Rather than using `createBaseNodeFactory` here, we establish a `BaseNodeFactory` that closes over the - // constructors above, which are reset each time `initializeState` is called. - const baseNodeFactory: BaseNodeFactory = { - createBaseSourceFileNode: () => countNode(new SourceFileObject()), - createBaseIdentifierNode: () => countNode(new IdentifierObject()), - createBasePrivateIdentifierNode: () => countNode(new PrivateIdentifierObject()), - createBaseTokenNode: kind => countNode(new TokenObject(kind)), - createBaseNode: kind => countNode(new NodeObject(kind)) - }; - - const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode, baseNodeFactory); + const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode); let fileName: string; let sourceFlags: NodeFlags; @@ -1898,9 +1868,16 @@ namespace Parser { setTextRangePosWidth(sourceFile, 0, sourceText.length); setFields(sourceFile); + // include the file in the count + nodeCount++; + // If we parsed this as an external module, it may contain top-level await if (!isDeclarationFile && isExternalModule(sourceFile) && sourceFile.transformFlags & TransformFlags.ContainsPossibleTopLevelAwait) { - sourceFile = reparseTopLevelAwait(sourceFile); + const updated = reparseTopLevelAwait(sourceFile); + if (sourceFile !== updated) { + nodeCount++; + sourceFile = updated; + } setFields(sourceFile); } @@ -2514,6 +2491,7 @@ namespace Parser { (node as Mutable).flags |= NodeFlags.ThisNodeHasError; } + nodeCount++; return node; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 473ca23d5d70f..ee37443eb3bf7 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1,5 +1,4 @@ import { - BaseNodeFactory, CreateSourceFileOptions, EmitHelperFactory, GetCanonicalFileName, @@ -8135,7 +8134,6 @@ export interface GeneratedNamePart { export interface NodeFactory { /** @internal */ readonly parenthesizer: ParenthesizerRules; /** @internal */ readonly converters: NodeConverters; - /** @internal */ readonly baseFactory: BaseNodeFactory; /** @internal */ readonly flags: NodeFactoryFlags; createNodeArray(elements?: readonly T[], hasTrailingComma?: boolean): NodeArray; diff --git a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts index 76b96b955ecb1..d7fa5b078f7fe 100644 --- a/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts +++ b/src/deprecatedCompat/4.0/nodeFactoryTopLevelExports.ts @@ -37,10 +37,10 @@ import { NamedImportBindings, Node, NodeArray, + NodeConstructors, NoSubstitutionTemplateLiteral, NumericLiteral, ParameterDeclaration, - parseBaseNodeFactory, PostfixUnaryExpression, PrefixUnaryExpression, PrimaryExpression, @@ -1345,11 +1345,11 @@ export const createLogicalNot = deprecate(function createLogicalNot(operand: Exp /** @deprecated Use an appropriate `factory` method instead. */ export const createNode = deprecate(function createNode(kind: SyntaxKind, pos = 0, end = 0): Node { return setTextRangePosEnd( - kind === SyntaxKind.SourceFile ? parseBaseNodeFactory.createBaseSourceFileNode() : - kind === SyntaxKind.Identifier ? parseBaseNodeFactory.createBaseIdentifierNode() : - kind === SyntaxKind.PrivateIdentifier ? parseBaseNodeFactory.createBasePrivateIdentifierNode() : - !isNodeKind(kind) ? parseBaseNodeFactory.createBaseTokenNode(kind) : - parseBaseNodeFactory.createBaseNode(kind), + kind === SyntaxKind.SourceFile ? new NodeConstructors.SourceFileObject() : + kind === SyntaxKind.Identifier ? new NodeConstructors.IdentifierObject() : + kind === SyntaxKind.PrivateIdentifier ? new NodeConstructors.PrivateIdentifierObject() : + !isNodeKind(kind) ? new NodeConstructors.TokenObject(kind) : + new NodeConstructors.NodeObject(kind), pos, end ); diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 98a35af0fe3e0..10d7730be0cd0 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1329,9 +1329,7 @@ function isTrivia(s: string) { // are more aggressive than is strictly necessary. const textChangesTransformationContext: TransformationContext = { ...nullTransformationContext, - factory: createNodeFactory( - nullTransformationContext.factory.flags | NodeFactoryFlags.NoParenthesizerRules, - nullTransformationContext.factory.baseFactory), + factory: createNodeFactory(nullTransformationContext.factory.flags | NodeFactoryFlags.NoParenthesizerRules), }; /** @internal */ From a1da7e1a26962586c7e43980de22fc5282d0c3c7 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 15:26:11 -0400 Subject: [PATCH 05/24] Move the rest of services's NodeObject to compiler --- src/compiler/debug.ts | 10 + src/compiler/factory/nodeChildren.ts | 6 +- src/compiler/nodeConstructors.ts | 556 +++++++++++---------------- src/services/services.ts | 159 -------- 4 files changed, 243 insertions(+), 488 deletions(-) diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index d6ac2802a99cd..56ca98b0bf4ac 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -69,6 +69,7 @@ import { noop, ObjectFlags, ObjectType, + positionIsSynthesized, RelationComparisonResult, ScriptKind, Signature, @@ -81,6 +82,7 @@ import { SymbolFlags, symbolName, SyntaxKind, + TextRange, TransformFlags, Type, TypeFacts, @@ -365,6 +367,14 @@ export namespace Debug { } } + export function assertValidTextRange(range: TextRange, message?: string, stackCrawlMark?: AnyFunction) { + assert( + !positionIsSynthesized(range.pos) && !positionIsSynthesized(range.end), + message ?? "Node must have a real position for this operation", + /*verboseDebugInfo*/ undefined, + stackCrawlMark); + } + /** * Asserts a value has the specified type in typespace only (does not perform a runtime assertion). * This is useful in cases where we switch on `node.kind` and can be reasonably sure the type is accurate, and diff --git a/src/compiler/factory/nodeChildren.ts b/src/compiler/factory/nodeChildren.ts index 89fa8383b281d..eb1652a400902 100644 --- a/src/compiler/factory/nodeChildren.ts +++ b/src/compiler/factory/nodeChildren.ts @@ -1,14 +1,14 @@ import { Node } from "../_namespaces/ts"; -const nodeChildren = new WeakMap(); +const nodeChildren = new WeakMap(); /** @internal */ -export function getNodeChildren(node: Node): Node[] | undefined { +export function getNodeChildren(node: Node): readonly Node[] | undefined { return nodeChildren.get(node); } /** @internal */ -export function setNodeChildren(node: Node, children: Node[]): Node[] { +export function setNodeChildren(node: Node, children: readonly Node[]): readonly Node[] { nodeChildren.set(node, children); return children; } diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 459ff4fecd720..43f3a75903ac5 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -1,20 +1,28 @@ import { __String, AmdDependency, + append, AssignmentDeclarationKind, AutoGenerateInfo, BinaryExpression, + canHaveJSDoc, CheckJsDirective, CommentDirective, computePositionOfLineAndCharacter, createMultiMap, + createScanner, Debug, Declaration, DiagnosticWithLocation, EmitNode, + emptyArray, + EndOfFileToken, EntityName, ExportDeclaration, + factory, FileReference, + find, + findLast, FlowNode, forEach, forEachChild, @@ -23,11 +31,13 @@ import { getLineAndCharacterOfPosition, getLineStarts, getNameFromPropertyName, + getNodeChildren, getNonAssignedNameOfDeclaration, getSourceFileOfNode, getTokenPosOfNode, HasLocals, hasSyntacticModifier, + hasTabstop, Identifier, idText, ImportDeclaration, @@ -35,9 +45,12 @@ import { isBindingPattern, isComputedPropertyName, IScriptSnapshot, + isJSDocCommentContainingNode, isNamedExports, + isNodeKind, isPropertyAccessExpression, isPropertyName, + isTokenKind, JSDoc, JSDocTag, LanguageVariant, @@ -45,13 +58,13 @@ import { LineAndCharacter, ModeAwareCache, ModifierFlags, + Mutable, Node, NodeArray, NodeFlags, PackageJsonInfo, Path, PatternAmbientModule, - positionIsSynthesized, PrivateIdentifier, ReadonlyPragmaMap, RedirectInfo, @@ -61,6 +74,7 @@ import { ScriptKind, ScriptTarget, ServicesOnlyType, + setNodeChildren, SourceFile, SourceFileLike, Statement, @@ -69,6 +83,7 @@ import { Symbol, SymbolTable, SyntaxKind, + SyntaxList, TextChangeRange, Token, TransformFlags, @@ -80,198 +95,121 @@ import { } from "./_namespaces/ts"; /** @internal */ -export class NodeObject implements Node { - declare kind: TKind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: TKind) { - this.pos = -1; - this.end = -1; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.modifierFlagsCache = ModifierFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } - - private assertHasRealPosition(message?: string) { - // eslint-disable-next-line local/debug-assert - Debug.assert(!positionIsSynthesized(this.pos) && !positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); - } - - public getSourceFile(): SourceFile { +export abstract class BaseSyntaxObject implements Node { + static { this.prototype.kind = SyntaxKind.Unknown; } + declare kind: SyntaxKind; + + pos: number = -1; + end: number = -1; + id: number = 0; + flags: NodeFlags = NodeFlags.None; + modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` + transformFlags: TransformFlags = TransformFlags.None; + parent: Node = undefined!; + original: Node | undefined = undefined; + + abstract emitNode: EmitNode | undefined; + + getSourceFile(): SourceFile { return getSourceFileOfNode(this); } - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - this.assertHasRealPosition(); + getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + Debug.assertValidTextRange(this); return getTokenPosOfNode(this, sourceFile, includeJsDocComment); } - public getFullStart(): number { - this.assertHasRealPosition(); + getFullStart(): number { + Debug.assertValidTextRange(this); return this.pos; } - public getEnd(): number { - this.assertHasRealPosition(); + getEnd(): number { + Debug.assertValidTextRange(this); return this.end; } - public getWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); + getWidth(sourceFile?: SourceFile): number { + Debug.assertValidTextRange(this); return this.getEnd() - this.getStart(sourceFile); } - public getFullWidth(): number { - this.assertHasRealPosition(); + getFullWidth(): number { + Debug.assertValidTextRange(this); return this.end - this.pos; } - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - this.assertHasRealPosition(); + getLeadingTriviaWidth(sourceFile?: SourceFile): number { return this.getStart(sourceFile) - this.pos; } - public getFullText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); + getFullText(sourceFile?: SourceFile): string { + Debug.assertValidTextRange(this); + sourceFile ??= this.getSourceFile(); + return sourceFile.text.substring(this.pos, this.end); } - public getText(sourceFile?: SourceFile): string { - this.assertHasRealPosition(); - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } + getText(sourceFile?: SourceFile): string { + Debug.assertValidTextRange(this); + sourceFile ??= this.getSourceFile(); return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); } - public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); + getChildCount(sourceFile?: SourceFile): number { + return this.getChildren(sourceFile).length; } - public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); + getChildAt(index: number, sourceFile?: SourceFile): Node { + return this.getChildren(sourceFile)[index]; } - public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { - return forEachChild(this, cbNode, cbNodeArray); - } + abstract forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined; + abstract getChildren(sourceFile?: SourceFileLike): readonly Node[]; + abstract getFirstToken(sourceFile?: SourceFileLike): Node | undefined; + abstract getLastToken(sourceFile?: SourceFileLike): Node | undefined; } /** @internal */ -export class TokenObject implements Token { - declare kind: Kind; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor(kind: Kind) { - this.pos = -1; - this.end = -1; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.emitNode = undefined; - } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } +export abstract class BaseTokenObject extends BaseSyntaxObject { + // NOTE: Tokens generally do not have or need emitNode entries, so they are declared and not defined to reduce + // memory footprint. + declare emitNode: EmitNode | undefined; - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); + override forEachChild(_cbNode: (node: Node) => T, _cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + // Tokens cannot have source element children + return undefined; } - public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); + override getChildren(_sourceFile?: SourceFileLike): readonly Node[] { + return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc ?? emptyArray : emptyArray; } - public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); + override getFirstToken(_sourceFile?: SourceFileLike): Node | undefined { + // Tokens cannot have source element children + return undefined!; } - public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); + override getLastToken(_sourceFile?: SourceFileLike): Node | undefined { + // Tokens cannot have source element children + return undefined!; } +} - public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } +/** @internal */ +export class TokenObject extends BaseTokenObject implements Token { + override kind: TKind; - public forEachChild(): T | undefined { - return undefined; + constructor(kind: TKind) { + super(); + this.kind = kind; } } /** @internal */ -export class IdentifierObject implements Identifier { +export class IdentifierObject extends BaseTokenObject implements Identifier { + static { this.prototype.kind = SyntaxKind.Identifier; } + declare kind: SyntaxKind.Identifier; + declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; declare _leftHandSideExpressionBrand: any; @@ -282,220 +220,104 @@ export class IdentifierObject implements Identifier { declare _jsdocContainerBrand: any; declare _flowContainerBrand: any; - declare kind: SyntaxKind.Identifier; - declare escapedText: __String; - declare originalKeywordKind?: SyntaxKind | undefined; - declare autoGenerate: AutoGenerateInfo | undefined; - declare generatedImportReference?: ImportSpecifier | undefined; - declare isInJSDocNamespace?: boolean | undefined; - declare typeArguments?: NodeArray | undefined; - declare jsdocDotPos?: number | undefined; - declare hasExtendedUnicodeEscape?: boolean | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; - declare jsDoc?: JSDoc[] | undefined; - declare jsDocCache?: readonly JSDocTag[] | undefined; - declare flowNode?: FlowNode | undefined; - - constructor() { - this.pos = -1; - this.end = -1; - this.kind = SyntaxKind.Identifier; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } + // NOTE: Though tokens, Identifiers often need emitNode + override emitNode: EmitNode | undefined = undefined; + + escapedText: __String = "" as __String; + symbol: Symbol = undefined!; // initialized by checker + jsDoc: JSDoc[] | undefined = undefined; // initialized by parser (JsDocContainer) + flowNode: FlowNode | undefined = undefined; // initialized by binder (FlowContainer) get text(): string { return idText(this); } - - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } - - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; - } - - public getEnd(): number { - return this.end; - } - - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); - } - - public getFullWidth(): number { - return this.end - this.pos; - } - - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } - - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); - } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - - public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } - - public forEachChild(): T | undefined { - return undefined; - } - - static { this.prototype.kind = SyntaxKind.Identifier; } } /** @internal */ -export class PrivateIdentifierObject implements PrivateIdentifier { +export class PrivateIdentifierObject extends BaseTokenObject implements PrivateIdentifier { + static { PrivateIdentifierObject.prototype.kind = SyntaxKind.PrivateIdentifier; } + declare kind: SyntaxKind.PrivateIdentifier; + declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; declare _leftHandSideExpressionBrand: any; declare _updateExpressionBrand: any; declare _unaryExpressionBrand: any; declare _expressionBrand: any; - declare kind: SyntaxKind.PrivateIdentifier; - declare escapedText: __String; - declare autoGenerate: AutoGenerateInfo | undefined; - declare flags: NodeFlags; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; - declare id?: number | undefined; - declare parent: Node; - declare original?: Node | undefined; - declare emitNode?: EmitNode | undefined; - declare pos: number; - declare end: number; - - constructor() { - this.pos = -1; - this.end = -1; - this.kind = SyntaxKind.PrivateIdentifier; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - } - get text(): string { - return idText(this); - } + // NOTE: Though tokens, PrivateIdentifiers often need emitNode + override emitNode: EmitNode | undefined = undefined; - public getSourceFile(): SourceFile { - return getSourceFileOfNode(this); - } + escapedText: __String = "" as __String; - public getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { - return getTokenPosOfNode(this, sourceFile, includeJsDocComment); - } - - public getFullStart(): number { - return this.pos; + get text(): string { + return idText(this); } +} - public getEnd(): number { - return this.end; - } +/** @internal */ +export abstract class BaseNodeObject extends BaseSyntaxObject { + // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. + override emitNode: EmitNode | undefined = undefined; - public getWidth(sourceFile?: SourceFile): number { - return this.getEnd() - this.getStart(sourceFile); + override forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + return forEachChild(this, cbNode, cbNodeArray); } - public getFullWidth(): number { - return this.end - this.pos; + override getChildren(sourceFile?: SourceFileLike): readonly Node[] { + Debug.assertValidTextRange(this, "Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); + return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile)); } - public getLeadingTriviaWidth(sourceFile?: SourceFile): number { - return this.getStart(sourceFile) - this.pos; - } - - public getFullText(sourceFile?: SourceFile): string { - return (sourceFile || this.getSourceFile()).text.substring(this.pos, this.end); - } + override getFirstToken(sourceFile?: SourceFileLike): Node | undefined { + Debug.assertValidTextRange(this); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } - public getText(sourceFile?: SourceFile): string { - if (!sourceFile) { - sourceFile = this.getSourceFile(); + const child = find(children, child => child.kind < SyntaxKind.FirstJSDocNode || child.kind > SyntaxKind.LastJSDocNode); + if (!child) { + return undefined; } - return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); - } - public getChildCount(_sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getFirstToken(sourceFile); } - public getChildAt(_index: number, _sourceFile?: SourceFile): ServicesOnlyType { - throw new TypeError("Not implemented"); - } + override getLastToken(sourceFile?: SourceFileLike): Node | undefined { + Debug.assertValidTextRange(this); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } - public getChildren(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } + const child = findLast(children, child => child.kind < SyntaxKind.FirstJSDocNode || child.kind > SyntaxKind.LastJSDocNode); + if (!child) { + return undefined; + } - public getFirstToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getLastToken(sourceFile); } +} - public getLastToken(_sourceFile?: SourceFileLike): ServicesOnlyType { - throw new TypeError("Not implemented"); - } +/** @internal */ +export class NodeObject extends BaseNodeObject implements Node { + override kind: TKind; - public forEachChild(): T | undefined { - return undefined; + constructor(kind: TKind) { + super(); + this.kind = kind; } - - static { this.prototype.kind = SyntaxKind.PrivateIdentifier; } } /** @internal */ -export class SourceFileObject extends NodeObject implements SourceFile { +export class SourceFileObject extends BaseNodeObject implements SourceFile { + static { this.prototype.kind = SyntaxKind.SourceFile; } + declare kind: SyntaxKind.SourceFile; + declare _declarationBrand: any; declare _localsContainerBrand: any; - declare kind: SyntaxKind.SourceFile; + declare statements: NodeArray; declare endOfFileToken: Token; declare fileName: string; @@ -559,10 +381,6 @@ export class SourceFileObject extends NodeObject implemen private declare namedDeclarations: Map | undefined; - constructor() { - super(SyntaxKind.SourceFile); - } - public update(newText: string, textChangeRange: TextChangeRange): SourceFile { return updateSourceFile(this, newText, textChangeRange); } @@ -751,6 +569,92 @@ export class SourceFileObject extends NodeObject implemen } } } +} - static { this.prototype.kind = SyntaxKind.SourceFile; } +const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); + +function createChildren(node: Node, sourceFile: SourceFileLike | undefined): readonly Node[] { + if (!isNodeKind(node.kind)) { + return emptyArray; + } + + let children: Node[] | undefined; + + if (isJSDocCommentContainingNode(node)) { + /** Don't add trivia for "tokens" since this is in a comment. */ + forEachChild(node, child => { children = append(children, child); }); + return children ?? emptyArray; + } + + scanner.setText((sourceFile || getSourceFileOfNode(node)).text); + + let pos = node.pos; + const processNode = (child: Node) => { + children = addSyntheticNodes(children, pos, child.pos, node); + children = append(children, child); + pos = child.end; + }; + const processNodes = (nodes: NodeArray) => { + children = addSyntheticNodes(children, pos, nodes.pos, node); + children = append(children, createSyntaxList(nodes, node)); + pos = nodes.end; + }; + + // jsDocComments need to be the first children + if (canHaveJSDoc(node)) { + forEach(node.jsDoc, processNode); + } + + // For syntactic classifications, all trivia are classified together, including jsdoc comments. + // For that to work, the jsdoc comments should still be the leading trivia of the first child. + // Restoring the scanner position ensures that. + pos = node.pos; + forEachChild(node, processNode, processNodes); + children = addSyntheticNodes(children, pos, node.end, node); + scanner.setText(undefined); + return children ?? emptyArray; +} + +function addSyntheticNodes(nodes: Node[] | undefined, pos: number, end: number, parent: Node): Node[] | undefined { + scanner.resetTokenState(pos); + while (pos < end) { + const kind = scanner.scan(); + const textPos = scanner.getTokenEnd(); + if (textPos <= end) { + if (kind === SyntaxKind.Identifier) { + if (hasTabstop(parent)) { + continue; + } + Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); + } + Debug.assert(isTokenKind(kind)); + const token = factory.createToken(kind) as Mutable>; + token.pos = pos; + token.end = textPos; + token.parent = parent; + token.flags = parent.flags & NodeFlags.ContextFlags; + nodes = append(nodes, token); + } + pos = textPos; + if (kind === SyntaxKind.EndOfFileToken) { + break; + } + } + return nodes; +} + +function createSyntaxList(nodes: NodeArray, parent: Node): Node { + let children: Node[] | undefined; + let pos = nodes.pos; + for (const node of nodes) { + children = addSyntheticNodes(children, pos, node.pos, parent); + pos = node.end; + } + children = addSyntheticNodes(children, pos, nodes.end, parent); + const list = factory.createSyntaxList(children ?? emptyArray) as Mutable; + list.pos = nodes.pos; + list.end = nodes.end; + list.parent = parent; + list.flags = parent.flags & NodeFlags.ContextFlags; + return list; } diff --git a/src/services/services.ts b/src/services/services.ts index d6ef987b11d4d..5b681d8cc571e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -282,165 +282,6 @@ import * as classifier2020 from "./classifier2020"; /** The version of the language service API */ export const servicesVersion = "0.8"; -const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); - -function createChildren(node: Node, sourceFile: SourceFileLike | undefined): Node[] { - if (!isNodeKind(node.kind)) { - return emptyArray; - } - - const children: Node[] = []; - - if (isJSDocCommentContainingNode(node)) { - /** Don't add trivia for "tokens" since this is in a comment. */ - node.forEachChild(child => { - children.push(child); - }); - return children; - } - - scanner.setText((sourceFile || node.getSourceFile()).text); - let pos = node.pos; - const processNode = (child: Node) => { - addSyntheticNodes(children, pos, child.pos, node); - children.push(child); - pos = child.end; - }; - const processNodes = (nodes: NodeArray) => { - addSyntheticNodes(children, pos, nodes.pos, node); - children.push(createSyntaxList(nodes, node)); - pos = nodes.end; - }; - - // jsDocComments need to be the first children - if (canHaveJSDoc(node)) { - forEach(node.jsDoc, processNode); - } - - // For syntactic classifications, all trivia are classified together, including jsdoc comments. - // For that to work, the jsdoc comments should still be the leading trivia of the first child. - // Restoring the scanner position ensures that. - pos = node.pos; - node.forEachChild(processNode, processNodes); - addSyntheticNodes(children, pos, node.end, node); - scanner.setText(undefined); - return children; -} - -function addSyntheticNodes(nodes: Node[], pos: number, end: number, parent: Node): void { - scanner.resetTokenState(pos); - while (pos < end) { - const kind = scanner.scan(); - const textPos = scanner.getTokenEnd(); - if (textPos <= end) { - if (kind === SyntaxKind.Identifier) { - if (hasTabstop(parent)) { - continue; - } - Debug.fail(`Did not expect ${Debug.formatSyntaxKind(parent.kind)} to have an Identifier in its trivia`); - } - Debug.assert(isTokenKind(kind)); - const token = new NodeConstructors.TokenObject(kind) as any as Mutable>; - token.pos = pos; - token.end = textPos; - token.parent = parent; - token.flags = parent.flags & NodeFlags.ContextFlags; - nodes.push(token); - } - pos = textPos; - if (kind === SyntaxKind.EndOfFileToken) { - break; - } - } -} - -function createSyntaxList(nodes: NodeArray, parent: Node): Node { - const list = new NodeConstructors.NodeObject(SyntaxKind.SyntaxList) as Node as Mutable; - list.pos = nodes.pos; - list.end = nodes.end; - list.parent = parent; - list.flags = parent.flags & NodeFlags.ContextFlags; - - const children: Node[] = []; - let pos = nodes.pos; - for (const node of nodes) { - addSyntheticNodes(children, pos, node.pos, parent); - children.push(node); - pos = node.end; - } - addSyntheticNodes(children, pos, nodes.end, parent); - setNodeChildren(list, children); - return list; -} - -interface NodeInternals { - assertHasRealPosition(message?: string): void; -} - -NodeConstructors.NodeObject.prototype.getChildCount = function (this: Node & NodeInternals, sourceFile?: SourceFile) { - return this.getChildren(sourceFile).length; -}; - -NodeConstructors.NodeObject.prototype.getChildAt = function (this: Node & NodeInternals, index: number, sourceFile?: SourceFile) { - return this.getChildren(sourceFile)[index]; -}; - -NodeConstructors.NodeObject.prototype.getChildren = function (this: Node & NodeInternals, sourceFile?: SourceFileLike) { - this.assertHasRealPosition("Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); - return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile)); -}; - -NodeConstructors.NodeObject.prototype.getFirstToken = function (this: Node & NodeInternals, sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - if (!children.length) { - return undefined; - } - - const child = find(children, kid => kid.kind < SyntaxKind.FirstJSDocNode || kid.kind > SyntaxKind.LastJSDocNode)!; - return child.kind < SyntaxKind.FirstNode ? - child : - child.getFirstToken(sourceFile); -}; - -NodeConstructors.NodeObject.prototype.getLastToken = function (this: Node & NodeInternals, sourceFile?: SourceFileLike): Node | undefined { - this.assertHasRealPosition(); - const children = this.getChildren(sourceFile); - - const child = lastOrUndefined(children); - if (!child) { - return undefined; - } - - return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); -}; - -for (const ctor of [ - NodeConstructors.TokenObject, - NodeConstructors.IdentifierObject, - NodeConstructors.PrivateIdentifierObject, -]) { - ctor.prototype.getChildCount = function (this: Node & NodeInternals, sourceFile?: SourceFile) { - return this.getChildren(sourceFile).length; - }; - - ctor.prototype.getChildAt = function (this: Node & NodeInternals, index: number, sourceFile?: SourceFile) { - return this.getChildren(sourceFile)[index]; - }; - - ctor.prototype.getChildren = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike) { - return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc || emptyArray : emptyArray; - }; - - ctor.prototype.getFirstToken = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike): Node | undefined { - return undefined; - }; - - ctor.prototype.getLastToken = function (this: Node & NodeInternals, _sourceFile?: SourceFileLike): Node | undefined { - return undefined; - }; -} - // Patch Symbol for use with services. interface SymbolInternals { // Undefined is used to indicate the value has not been computed. If, after computing, the From 1bb7e2f4e5dbfe7e234e46883381399aa445f829 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 16:30:45 -0400 Subject: [PATCH 06/24] Define concrete fields for known inputs --- src/compiler/objectConstructors.ts | 108 +++++++++++++++++++---------- src/services/services.ts | 3 + 2 files changed, 74 insertions(+), 37 deletions(-) diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index e45e390487c71..bdec56609c2b2 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -44,39 +44,37 @@ import { /** @internal */ export class SymbolObject implements Symbol { - declare flags: SymbolFlags; - declare escapedName: __String; - declare declarations?: Declaration[] | undefined; - declare valueDeclaration?: Declaration | undefined; - declare members?: SymbolTable | undefined; - declare exports?: SymbolTable | undefined; - declare globalExports?: SymbolTable | undefined; - declare id: number; - declare mergeId: number; - declare parent?: Symbol | undefined; - declare exportSymbol?: Symbol | undefined; - declare constEnumOnlyModule: boolean | undefined; - declare isReferenced?: SymbolFlags | undefined; + flags: SymbolFlags = 0; + escapedName: __String = "" as __String; + declarations: Declaration[] | undefined = undefined; + valueDeclaration: Declaration | undefined = undefined; + id = 0; + mergeId = 0; + parent: Symbol | undefined = undefined; + members: SymbolTable | undefined = undefined; + exports: SymbolTable | undefined = undefined; + exportSymbol: Symbol | undefined = undefined; + constEnumOnlyModule: boolean | undefined = undefined; + isReferenced: SymbolFlags | undefined = undefined; + lastAssignmentPos: number | undefined = undefined; + links: SymbolLinks | undefined = undefined; // used by TransientSymbol + + // TODO: Review these for polymorphism: declare isReplaceableByMethod?: boolean | undefined; - declare lastAssignmentPos?: number | undefined; declare assignmentDeclarationMembers?: Map | undefined; - declare links?: SymbolLinks; + declare globalExports?: SymbolTable | undefined; + + // TODO: Added by services, review for migration/polymorphism: + // documentationComment?: SymbolDisplayPart[]; + // tags?: JSDocTagInfo[]; // same + // contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; + // contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; + // contextualGetAccessorTags?: JSDocTagInfo[]; + // contextualSetAccessorTags?: JSDocTagInfo[]; constructor(flags: SymbolFlags, name: __String) { this.flags = flags; this.escapedName = name; - this.declarations = undefined; - this.valueDeclaration = undefined; - this.id = 0; - this.mergeId = 0; - this.parent = undefined; - this.members = undefined; - this.exports = undefined; - this.exportSymbol = undefined; - this.constEnumOnlyModule = undefined; - this.isReferenced = undefined; - this.lastAssignmentPos = undefined; - this.links = undefined; // used by TransientSymbol } getFlags(): SymbolFlags { @@ -118,9 +116,11 @@ export class SymbolObject implements Symbol { /** @internal */ export class TypeObject implements Type { - declare flags: TypeFlags; + flags: TypeFlags; + checker: TypeChecker; + + // TODO: Review for polymorphism declare id: number; - declare checker: TypeChecker; declare symbol: Symbol; declare pattern?: DestructuringPattern | undefined; declare aliasSymbol?: Symbol | undefined; @@ -132,7 +132,6 @@ export class TypeObject implements Type { declare widened?: Type | undefined; constructor(checker: TypeChecker, flags: TypeFlags) { - // TODO: stabilize map this.flags = flags; this.checker = checker; } @@ -140,45 +139,59 @@ export class TypeObject implements Type { getFlags(): TypeFlags { return this.flags; } + getSymbol(): Symbol | undefined { return this.symbol; } + getProperties(): Symbol[] { return this.checker.getPropertiesOfType(this); } + getProperty(propertyName: string): Symbol | undefined { return this.checker.getPropertyOfType(this, propertyName); } + getApparentProperties(): Symbol[] { return this.checker.getAugmentedPropertiesOfType(this); } + getCallSignatures(): readonly Signature[] { return this.checker.getSignaturesOfType(this, SignatureKind.Call); } + getConstructSignatures(): readonly Signature[] { return this.checker.getSignaturesOfType(this, SignatureKind.Construct); } + getStringIndexType(): Type | undefined { return this.checker.getIndexTypeOfType(this, IndexKind.String); } + getNumberIndexType(): Type | undefined { return this.checker.getIndexTypeOfType(this, IndexKind.Number); } + getBaseTypes(): BaseType[] | undefined { return this.isClassOrInterface() ? this.checker.getBaseTypes(this) : undefined; } + isNullableType(): boolean { return this.checker.isNullableType(this); } + getNonNullableType(): Type { return this.checker.getNonNullableType(this); } + getNonOptionalType(): Type { return this.checker.getNonOptionalType(this); } + getConstraint(): Type | undefined { return this.checker.getBaseConstraintOfType(this); } + getDefault(): Type | undefined { return this.checker.getDefaultFromTypeParameter(this); } @@ -186,33 +199,43 @@ export class TypeObject implements Type { isUnion(): this is UnionType { return !!(this.flags & TypeFlags.Union); } + isIntersection(): this is IntersectionType { return !!(this.flags & TypeFlags.Intersection); } + isUnionOrIntersection(): this is UnionOrIntersectionType { return !!(this.flags & TypeFlags.UnionOrIntersection); } + isLiteral(): this is LiteralType { return !!(this.flags & (TypeFlags.StringLiteral | TypeFlags.NumberLiteral | TypeFlags.BigIntLiteral)); } + isStringLiteral(): this is StringLiteralType { return !!(this.flags & TypeFlags.StringLiteral); } + isNumberLiteral(): this is NumberLiteralType { return !!(this.flags & TypeFlags.NumberLiteral); } + isTypeParameter(): this is TypeParameter { return !!(this.flags & TypeFlags.TypeParameter); } + isClassOrInterface(): this is InterfaceType { return !!(getObjectFlags(this) & ObjectFlags.ClassOrInterface); } + isClass(): this is InterfaceType { return !!(getObjectFlags(this) & ObjectFlags.Class); } + isIndexType(): this is IndexType { return isIndexType(this); } + /** * This polyfills `referenceType.typeArguments` for API consumers */ @@ -226,8 +249,10 @@ export class TypeObject implements Type { /** @internal */ export class SignatureObject implements Signature { - declare flags: SignatureFlags; - declare checker: TypeChecker; + flags: SignatureFlags; + checker: TypeChecker; + + // TODO: Review for polymorphism: declare declaration?: JSDocSignature | SignatureDeclaration | undefined; declare typeParameters?: readonly TypeParameter[] | undefined; declare parameters: readonly Symbol[]; @@ -247,6 +272,10 @@ export class SignatureObject implements Signature { declare isolatedSignatureType?: ObjectType | undefined; declare instantiations?: Map | undefined; + // TODO: Added by services, review for migration/polymorhpism: + // documentationComment?: SymbolDisplayPart[]; + // jsDocTags?: JSDocTagInfo[]; // same + constructor(checker: TypeChecker, flags: SignatureFlags) { // TODO: stabilize map this.flags = flags; @@ -256,15 +285,19 @@ export class SignatureObject implements Signature { getDeclaration(): JSDocSignature | SignatureDeclaration { return this.declaration ?? Debug.fail(); } + getTypeParameters(): readonly TypeParameter[] | undefined { return this.typeParameters; } + getParameters(): readonly Symbol[] { return this.parameters; } + getReturnType(): Type { return this.checker.getReturnTypeOfSignature(this); } + getTypeParameterAtPosition(pos: number): Type { const type = this.checker.getParameterType(this, pos); if (isIndexType(type) && isThisTypeParameter(type.type)) { @@ -287,13 +320,14 @@ export class SignatureObject implements Signature { /** @internal */ export class SourceMapSourceObject implements SourceMapSource { - declare fileName: string; - declare text: string; - declare skipTrivia: ((pos: number) => number); + fileName: string; + text: string; + skipTrivia: ((pos: number) => number); + + // TODO: Review for polymorphism: declare lineMap: readonly number[]; constructor(fileName: string, text: string, skipTrivia: (pos: number) => number = identity) { - // TODO: stabilize map this.fileName = fileName; this.text = text; this.skipTrivia = skipTrivia; @@ -306,4 +340,4 @@ export class SourceMapSourceObject implements SourceMapSource { function isIndexType(type: Type): type is IndexType { return !!(type.flags & TypeFlags.Index); -} \ No newline at end of file +} diff --git a/src/services/services.ts b/src/services/services.ts index 5b681d8cc571e..9585c843dc5cf 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -282,6 +282,7 @@ import * as classifier2020 from "./classifier2020"; /** The version of the language service API */ export const servicesVersion = "0.8"; +// TODO: Move SymbolInternals to compiler // Patch Symbol for use with services. interface SymbolInternals { // Undefined is used to indicate the value has not been computed. If, after computing, the @@ -363,6 +364,8 @@ ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (thi return this.getJsDocTags(checker); }; +// TODO: Move SignatureInternals to compiler + interface SignatureInternals { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. From 1a4825238513228e3ca8fe114b0d133a6eeddbab Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 16:32:21 -0400 Subject: [PATCH 07/24] Run formatter --- src/compiler/binder.ts | 2 +- src/compiler/debug.ts | 13 +++++++------ src/compiler/factory/nodeFactory.ts | 4 +--- src/compiler/nodeConstructors.ts | 22 ++++++++++++++++------ src/compiler/objectConstructors.ts | 2 +- src/compiler/types.ts | 7 +++---- src/compiler/utilities.ts | 3 +-- src/services/textChanges.ts | 3 +-- src/services/types.ts | 2 +- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c1a5e5bd63c17..38451367bb6d2 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -320,8 +320,8 @@ import { WhileStatement, WithStatement, } from "./_namespaces/ts"; -import { SymbolObject as SymbolObject } from "./objectConstructors"; import * as performance from "./_namespaces/ts.performance"; +import { SymbolObject as SymbolObject } from "./objectConstructors"; /** @internal */ export const enum ModuleInstanceState { diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 56ca98b0bf4ac..2aa31b9f1eb8a 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -93,17 +93,17 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; -import { - SignatureObject, - SymbolObject, - TypeObject, -} from "./objectConstructors"; import { IdentifierObject, NodeObject, SourceFileObject, TokenObject, } from "./nodeConstructors"; +import { + SignatureObject, + SymbolObject, + TypeObject, +} from "./objectConstructors"; /** @internal */ export enum LogLevel { @@ -372,7 +372,8 @@ export namespace Debug { !positionIsSynthesized(range.pos) && !positionIsSynthesized(range.end), message ?? "Node must have a real position for this operation", /*verboseDebugInfo*/ undefined, - stackCrawlMark); + stackCrawlMark, + ); } /** diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index d876d70b468c4..9b571b505804a 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -461,9 +461,7 @@ import { SourceFileObject, TokenObject, } from "../nodeConstructors"; -import { - SourceMapSourceObject, -} from "../objectConstructors"; +import { SourceMapSourceObject } from "../objectConstructors"; let nextAutoGenerateId = 0; diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 43f3a75903ac5..cb836a7458d2a 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -96,7 +96,9 @@ import { /** @internal */ export abstract class BaseSyntaxObject implements Node { - static { this.prototype.kind = SyntaxKind.Unknown; } + static { + this.prototype.kind = SyntaxKind.Unknown; + } declare kind: SyntaxKind; pos: number = -1; @@ -207,7 +209,9 @@ export class TokenObject extends BaseTokenObject imple /** @internal */ export class IdentifierObject extends BaseTokenObject implements Identifier { - static { this.prototype.kind = SyntaxKind.Identifier; } + static { + this.prototype.kind = SyntaxKind.Identifier; + } declare kind: SyntaxKind.Identifier; declare _primaryExpressionBrand: any; @@ -235,7 +239,9 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { /** @internal */ export class PrivateIdentifierObject extends BaseTokenObject implements PrivateIdentifier { - static { PrivateIdentifierObject.prototype.kind = SyntaxKind.PrivateIdentifier; } + static { + PrivateIdentifierObject.prototype.kind = SyntaxKind.PrivateIdentifier; + } declare kind: SyntaxKind.PrivateIdentifier; declare _primaryExpressionBrand: any; @@ -312,7 +318,9 @@ export class NodeObject extends BaseNodeObject impleme /** @internal */ export class SourceFileObject extends BaseNodeObject implements SourceFile { - static { this.prototype.kind = SyntaxKind.SourceFile; } + static { + this.prototype.kind = SyntaxKind.SourceFile; + } declare kind: SyntaxKind.SourceFile; declare _declarationBrand: any; @@ -379,7 +387,7 @@ export class SourceFileObject extends BaseNodeObject implements SourceFile { declare scriptSnapshot: IScriptSnapshot; declare nameTable: UnderscoreEscapedMap | undefined; - private declare namedDeclarations: Map | undefined; + declare private namedDeclarations: Map | undefined; public update(newText: string, textChangeRange: TextChangeRange): SourceFile { return updateSourceFile(this, newText, textChangeRange); @@ -582,7 +590,9 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea if (isJSDocCommentContainingNode(node)) { /** Don't add trivia for "tokens" since this is in a comment. */ - forEachChild(node, child => { children = append(children, child); }); + forEachChild(node, child => { + children = append(children, child); + }); return children ?? emptyArray; } diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index bdec56609c2b2..630172aa4f089 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -322,7 +322,7 @@ export class SignatureObject implements Signature { export class SourceMapSourceObject implements SourceMapSource { fileName: string; text: string; - skipTrivia: ((pos: number) => number); + skipTrivia: (pos: number) => number; // TODO: Review for polymorphism: declare lineMap: readonly number[]; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index be2b81ed8e0b4..1b8d85d0646bd 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -6192,7 +6192,6 @@ export interface Type { widened?: Type; // Cached widened form of the type } - /** @internal */ // Intrinsic types (TypeFlags.Intrinsic) export interface IntrinsicType extends Type { @@ -10147,21 +10146,21 @@ export interface EvaluationResolver { * Resolves to a type only when the 'services' project is loaded. Otherwise, results in `never`. * @internal */ -export type ServicesOnlyType = ServicesForwardRefs extends { __services: true } ? T : Fallback; +export type ServicesOnlyType = ServicesForwardRefs extends { __services: true; } ? T : Fallback; /** * Resolves a forward-reference to a type declared in the 'services' project. * If 'services' is not present, results in `never`. * @internal */ -export type ServicesForwardRef = ServicesForwardRefs extends { [P in K]: infer T } ? T : never; +export type ServicesForwardRef = ServicesForwardRefs extends { [P in K]: infer T; } ? T : never; /** * Resolves a forward-reference to an array of a type declared in the 'services' project. * If 'services' is not present, results in `never`. * @internal */ - export type ServicesForwardRefArray = ServicesOnlyType[]>; +export type ServicesForwardRefArray = ServicesOnlyType[]>; /** * A registry of forward references declared in the 'services' project. diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 4c33ede1d6534..9989f809c7e38 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -205,8 +205,8 @@ import { HasExpressionInitializer, hasExtension, HasFlowNode, - hasInitializer, HasInitializer, + hasInitializer, HasJSDoc, hasJSDocNodes, HasModifiers, @@ -5295,7 +5295,6 @@ export function getNameFromPropertyName(name: PropertyName): string | undefined : isPrivateIdentifier(name) ? idText(name) : getTextOfIdentifierOrLiteral(name); } - // TODO(jakebailey): this function should not be named this. While it does technically // return true if the argument is a ParameterDeclaration, it also returns true for nodes // that are children of ParameterDeclarations inside binding elements. diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts index 65ce1c401309e..de0cfc755b6a6 100644 --- a/src/services/textChanges.ts +++ b/src/services/textChanges.ts @@ -1374,8 +1374,7 @@ function isTrivia(s: string) { // are more aggressive than is strictly necessary. const textChangesTransformationContext: TransformationContext = { ...nullTransformationContext, - factory: createNodeFactory(nullTransformationContext.factory.flags | NodeFactoryFlags.NoParenthesizerRules, - ), + factory: createNodeFactory(nullTransformationContext.factory.flags | NodeFactoryFlags.NoParenthesizerRules), }; /** @internal */ diff --git a/src/services/types.ts b/src/services/types.ts index 99311f93c0592..0c5ad370d2f80 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -14,8 +14,8 @@ import { GetEffectiveTypeRootsHost, HasChangedAutomaticTypeDirectiveNames, HasInvalidatedResolutions, - JSDocParsingMode, IScriptSnapshot, + JSDocParsingMode, LineAndCharacter, MinimalResolutionCacheHost, ModuleResolutionCache, From 15ad90e54328c13fc74e492726ac190b9c05d1b3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 16:36:52 -0400 Subject: [PATCH 08/24] Fix lint warnings --- src/compiler/nodeConstructors.ts | 17 +++++++---------- src/services/services.ts | 17 ----------------- 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index cb836a7458d2a..1a403ab4f5644 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -3,7 +3,6 @@ import { AmdDependency, append, AssignmentDeclarationKind, - AutoGenerateInfo, BinaryExpression, canHaveJSDoc, CheckJsDirective, @@ -41,7 +40,6 @@ import { Identifier, idText, ImportDeclaration, - ImportSpecifier, isBindingPattern, isComputedPropertyName, IScriptSnapshot, @@ -52,7 +50,6 @@ import { isPropertyName, isTokenKind, JSDoc, - JSDocTag, LanguageVariant, lastOrUndefined, LineAndCharacter, @@ -71,9 +68,9 @@ import { ResolutionMode, ResolvedModuleWithFailedLookupLocations, ResolvedTypeReferenceDirectiveWithFailedLookupLocations, + Scanner, ScriptKind, ScriptTarget, - ServicesOnlyType, setNodeChildren, SourceFile, SourceFileLike, @@ -87,8 +84,6 @@ import { TextChangeRange, Token, TransformFlags, - TypeNode, - TypeParameterDeclaration, UnderscoreEscapedMap, updateSourceFile, VariableDeclaration, @@ -101,9 +96,9 @@ export abstract class BaseSyntaxObject implements Node { } declare kind: SyntaxKind; - pos: number = -1; - end: number = -1; - id: number = 0; + pos = -1; + end = -1; + id = 0; flags: NodeFlags = NodeFlags.None; modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` transformFlags: TransformFlags = TransformFlags.None; @@ -579,7 +574,7 @@ export class SourceFileObject extends BaseNodeObject implements SourceFile { } } -const scanner = createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); +let scanner: Scanner | undefined; function createChildren(node: Node, sourceFile: SourceFileLike | undefined): readonly Node[] { if (!isNodeKind(node.kind)) { @@ -596,6 +591,7 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea return children ?? emptyArray; } + scanner ??= createScanner(ScriptTarget.Latest, /*skipTrivia*/ true); scanner.setText((sourceFile || getSourceFileOfNode(node)).text); let pos = node.pos; @@ -626,6 +622,7 @@ function createChildren(node: Node, sourceFile: SourceFileLike | undefined): rea } function addSyntheticNodes(nodes: Node[] | undefined, pos: number, end: number, parent: Node): Node[] | undefined { + Debug.assertIsDefined(scanner); scanner.resetTokenState(pos); while (pos < end) { const kind = scanner.scan(); diff --git a/src/services/services.ts b/src/services/services.ts index 9585c843dc5cf..d26a180a46c60 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -8,7 +8,6 @@ import { CallHierarchyItem, CallHierarchyOutgoingCall, CancellationToken, - canHaveJSDoc, changeCompilerHostLikeToUseCache, CharacterCodes, Classifications, @@ -33,7 +32,6 @@ import { createGetCanonicalFileName, createProgram, CreateProgramOptions, - createScanner, createSourceFile, CreateSourceFileOptions, createTextSpanFromBounds, @@ -57,13 +55,11 @@ import { EmitTextWriter, emptyArray, emptyOptions, - EndOfFileToken, equateValues, Extension, extensionFromPath, FileTextChanges, filter, - find, FindAllReferences, findAncestor, findChildOfKind, @@ -94,7 +90,6 @@ import { getNameFromPropertyName, getNewLineCharacter, getNewLineOrDefaultFromHost, - getNodeChildren, getNormalizedAbsolutePath, getQuotePreference, getScriptKind, @@ -108,7 +103,6 @@ import { hasJSDocNodes, hasProperty, hasStaticModifier, - hasTabstop, HostCancellationToken, hostGetCanonicalFileName, hostUsesCaseSensitiveFileNames, @@ -133,7 +127,6 @@ import { isInString, isInTemplateString, isIntrinsicJsxName, - isJSDocCommentContainingNode, isJsxAttributes, isJsxClosingElement, isJsxElement, @@ -147,7 +140,6 @@ import { isNamedTupleMember, isNameOfModuleDeclaration, isNewExpression, - isNodeKind, isObjectLiteralElement, isObjectLiteralExpression, isPrivateIdentifier, @@ -158,7 +150,6 @@ import { isStringOrNumericLiteralLike, isTagName, isTextWhiteSpaceLike, - isTokenKind, isTransientSymbol, JsDoc, JSDocParsingMode, @@ -172,7 +163,6 @@ import { LanguageService, LanguageServiceHost, LanguageServiceMode, - lastOrUndefined, length, LineAndCharacter, lineBreakPart, @@ -184,13 +174,10 @@ import { maybeBind, maybeSetLocalizedDiagnosticMessages, ModuleDeclaration, - Mutable, NavigateToItem, NavigationBarItem, NavigationTree, Node, - NodeArray, - NodeConstructors, NodeFlags, noop, normalizePath, @@ -231,7 +218,6 @@ import { ScriptTarget, SelectionRange, SemanticClassificationFormat, - setNodeChildren, Signature, SignatureHelp, SignatureHelpItems, @@ -240,14 +226,12 @@ import { SmartSelectionRange, SortedArray, SourceFile, - SourceFileLike, startsWith, StringLiteralLike, Symbol, SymbolDisplay, SymbolDisplayPart, SyntaxKind, - SyntaxList, sys, tagNamesAreEquivalent, TextChange, @@ -259,7 +243,6 @@ import { timestamp, TodoComment, TodoCommentDescriptor, - Token, toPath, tracing, TransientSymbol, From 6caf90860511e2d45b19398e5bdcc0331dfc7807 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 18:21:45 -0400 Subject: [PATCH 09/24] Fixes and baseline updates --- scripts/build/options.mjs | 4 +- scripts/build/tests.mjs | 6 +- src/compiler/factory/nodeFactory.ts | 2 +- src/compiler/nodeConstructors.ts | 68 +++++++++-------- src/compiler/objectConstructors.ts | 73 +++++++++---------- src/compiler/types.ts | 6 +- src/services/smartSelection.ts | 6 +- src/services/types.ts | 4 +- src/services/utilities.ts | 2 +- ...Correctly.@@ does not start a new tag.json | 4 +- ...ocComments.parsesCorrectly.@link tags.json | 64 ++++++++-------- ...y.Chained tags, no leading whitespace.json | 10 +-- ...ly.Initial email address is not a tag.json | 2 +- ...esCorrectly.Initial star is not a tag.json | 2 +- ...ectly.Initial star space is not a tag.json | 4 +- ...ts.parsesCorrectly.Nested @param tags.json | 14 ++-- ...sCorrectly.Single trailing whitespace.json | 2 +- ...parsesCorrectly.argSynonymForParamTag.json | 6 +- ...sCorrectly.argumentSynonymForParamTag.json | 6 +- ...parsesCorrectly.asteriskAfterPreamble.json | 6 +- ...DocComments.parsesCorrectly.authorTag.json | 66 ++++++++--------- ...sCorrectly.consecutive newline tokens.json | 4 +- ...Comments.parsesCorrectly.emptyComment.json | 4 +- ...omments.parsesCorrectly.exceptionTag1.json | 8 +- ...omments.parsesCorrectly.exceptionTag2.json | 4 +- ...omments.parsesCorrectly.exceptionTag3.json | 8 +- ...ocComments.parsesCorrectly.importTag1.json | 8 +- ...ocComments.parsesCorrectly.importTag2.json | 12 +-- ...ocComments.parsesCorrectly.importTag3.json | 10 +-- ...ocComments.parsesCorrectly.importTag4.json | 10 +-- ...ments.parsesCorrectly.leadingAsterisk.json | 6 +- ...less-than and greater-than characters.json | 4 +- ...ly.no space before @ is not a new tag.json | 10 +-- ...nts.parsesCorrectly.noLeadingAsterisk.json | 6 +- ...Comments.parsesCorrectly.noReturnType.json | 4 +- ...cComments.parsesCorrectly.oneParamTag.json | 6 +- ...DocComments.parsesCorrectly.paramTag1.json | 6 +- ...arsesCorrectly.paramTagBracketedName1.json | 6 +- ...arsesCorrectly.paramTagBracketedName2.json | 6 +- ...parsesCorrectly.paramTagNameThenType1.json | 6 +- ...parsesCorrectly.paramTagNameThenType2.json | 6 +- ...ents.parsesCorrectly.paramWithoutType.json | 4 +- ...ocComments.parsesCorrectly.returnTag1.json | 6 +- ...ocComments.parsesCorrectly.returnTag2.json | 6 +- ...cComments.parsesCorrectly.returnsTag1.json | 6 +- ...Comments.parsesCorrectly.satisfiesTag.json | 6 +- ...cComments.parsesCorrectly.templateTag.json | 6 +- ...Comments.parsesCorrectly.templateTag2.json | 8 +- ...Comments.parsesCorrectly.templateTag3.json | 8 +- ...Comments.parsesCorrectly.templateTag4.json | 8 +- ...Comments.parsesCorrectly.templateTag5.json | 8 +- ...Comments.parsesCorrectly.templateTag6.json | 8 +- ...mments.parsesCorrectly.threeAsterisks.json | 2 +- ...ocComments.parsesCorrectly.throwsTag1.json | 8 +- ...ocComments.parsesCorrectly.throwsTag2.json | 4 +- ...ocComments.parsesCorrectly.throwsTag3.json | 8 +- ...Comments.parsesCorrectly.twoParamTag2.json | 10 +-- ...parsesCorrectly.twoParamTagOnSameLine.json | 10 +-- .../DocComments.parsesCorrectly.typeTag.json | 6 +- ...sCorrectly.typedefTagWithChildrenTags.json | 14 ++-- ...peExpressions.parsesCorrectly.allType.json | 4 +- ...xpressions.parsesCorrectly.arrayType1.json | 4 +- ...xpressions.parsesCorrectly.arrayType2.json | 6 +- ...xpressions.parsesCorrectly.arrayType3.json | 10 +-- ...esCorrectly.callSignatureInRecordType.json | 4 +- ...s.parsesCorrectly.functionReturnType1.json | 6 +- ...essions.parsesCorrectly.functionType1.json | 2 +- ...essions.parsesCorrectly.functionType2.json | 6 +- ...rrectly.functionTypeWithTrailingComma.json | 6 +- ...eExpressions.parsesCorrectly.keyword1.json | 2 +- ...eExpressions.parsesCorrectly.keyword2.json | 2 +- ...ns.parsesCorrectly.methodInRecordType.json | 4 +- ...eExpressions.parsesCorrectly.newType1.json | 8 +- ...sions.parsesCorrectly.nonNullableType.json | 2 +- ...ions.parsesCorrectly.nonNullableType2.json | 2 +- ...ressions.parsesCorrectly.nullableType.json | 2 +- ...essions.parsesCorrectly.nullableType2.json | 2 +- ...ions.parsesCorrectly.optionalNullable.json | 6 +- ...ressions.parsesCorrectly.optionalType.json | 2 +- ...pressions.parsesCorrectly.recordType1.json | 2 +- ...pressions.parsesCorrectly.recordType2.json | 4 +- ...pressions.parsesCorrectly.recordType3.json | 4 +- ...pressions.parsesCorrectly.recordType4.json | 6 +- ...pressions.parsesCorrectly.recordType5.json | 6 +- ...pressions.parsesCorrectly.recordType6.json | 6 +- ...pressions.parsesCorrectly.recordType7.json | 6 +- ...pressions.parsesCorrectly.recordType8.json | 4 +- ...Expressions.parsesCorrectly.thisType1.json | 8 +- ...sesCorrectly.topLevelNoParenUnionType.json | 2 +- ...esCorrectly.trailingCommaInRecordType.json | 4 +- ...ons.parsesCorrectly.tsConstructorType.json | 2 +- ...ssions.parsesCorrectly.tsFunctionType.json | 2 +- ...xpressions.parsesCorrectly.tupleType0.json | 2 +- ...xpressions.parsesCorrectly.tupleType1.json | 2 +- ...xpressions.parsesCorrectly.tupleType2.json | 2 +- ...xpressions.parsesCorrectly.tupleType3.json | 2 +- ...sCorrectly.tupleTypeWithTrailingComma.json | 2 +- ...orrectly.typeArgumentsNotFollowingDot.json | 2 +- ...xpressions.parsesCorrectly.typeOfType.json | 2 +- ...ssions.parsesCorrectly.typeReference1.json | 2 +- ...ssions.parsesCorrectly.typeReference2.json | 2 +- ...ssions.parsesCorrectly.typeReference3.json | 4 +- ...Expressions.parsesCorrectly.unionType.json | 4 +- ...orrectly.unionTypeWithLeadingOperator.json | 4 +- ...nTypeWithOneElementAndLeadingOperator.json | 4 +- ...pressions.parsesCorrectly.unknownType.json | 4 +- ...ressions.parsesCorrectly.variadicType.json | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- ...deprecated-ParseForTypeErrors-file.ts.diff | 6 +- .../deprecated-ParseForTypeInfo-file.ts.diff | 12 +-- .../deprecated-ParseNone-file.js.diff | 12 +-- .../deprecated-ParseNone-file.ts.diff | 12 +-- .../link-ParseForTypeInfo-file.ts.diff | 6 +- .../link-ParseNone-file.js.diff | 6 +- .../link-ParseNone-file.ts.diff | 6 +- .../see-ParseForTypeInfo-file.ts.diff | 26 +++---- .../see-ParseNone-file.js.diff | 26 +++---- .../see-ParseNone-file.ts.diff | 26 +++---- 118 files changed, 476 insertions(+), 467 deletions(-) diff --git a/scripts/build/options.mjs b/scripts/build/options.mjs index c4cb9c47233cd..e9da458f0c4cc 100644 --- a/scripts/build/options.mjs +++ b/scripts/build/options.mjs @@ -4,7 +4,7 @@ import os from "os"; const ci = ["1", "true"].includes(process.env.CI ?? ""); const parsed = minimist(process.argv.slice(2), { - boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck", "lint", "coverage"], + boolean: ["dirty", "light", "colors", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci", "bundle", "typecheck", "lint", "coverage", "bail"], string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"], alias: { b: "browser", @@ -41,6 +41,7 @@ const parsed = minimist(process.argv.slice(2), { typecheck: true, lint: true, coverage: false, + bail: false, }, }); @@ -86,5 +87,6 @@ export default options; * @property {boolean} typecheck * @property {boolean} lint * @property {boolean} coverage + * @property {boolean} bail */ void 0; diff --git a/scripts/build/tests.mjs b/scripts/build/tests.mjs index d247694dcb314..9c39ca9ed62ae 100644 --- a/scripts/build/tests.mjs +++ b/scripts/build/tests.mjs @@ -41,6 +41,7 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt const shards = +cmdLineOptions.shards || undefined; const shardId = +cmdLineOptions.shardId || undefined; const coverage = cmdLineOptions.coverage; + const bail = cmdLineOptions.bail; if (!cmdLineOptions.dirty) { if (options.watching) { console.log(chalk.yellowBright(`[watch] cleaning test directories...`)); @@ -84,12 +85,15 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt /** @type {string[]} */ const args = []; - // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally + // timeout normally isn't necessary but Travis-CI has been timing out on compiler selines occasionally // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer if (!runInParallel) { args.push(mochaJs); args.push("-R", findUpFile("scripts/failed-tests.cjs")); args.push("-O", '"reporter=' + reporter + (keepFailed ? ",keepFailed=true" : "") + '"'); + if (bail) { + args.push("--bail"); + } if (tests) { args.push("-g", `"${tests}"`); } diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 9b571b505804a..79a74264020f2 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -6224,7 +6224,7 @@ export function createNodeFactory(flags: NodeFactoryFlags): NodeFactory { } // @api - function createSyntaxList(children: Node[]) { + function createSyntaxList(children: readonly Node[]) { const node = createBaseNode(SyntaxKind.SyntaxList); setNodeChildren(node, children); return node; diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 1a403ab4f5644..886b63d7f2204 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -21,7 +21,6 @@ import { factory, FileReference, find, - findLast, FlowNode, forEach, forEachChild, @@ -100,11 +99,11 @@ export abstract class BaseSyntaxObject implements Node { end = -1; id = 0; flags: NodeFlags = NodeFlags.None; - modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` transformFlags: TransformFlags = TransformFlags.None; parent: Node = undefined!; original: Node | undefined = undefined; + abstract modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` abstract emitNode: EmitNode | undefined; getSourceFile(): SourceFile { @@ -168,9 +167,11 @@ export abstract class BaseSyntaxObject implements Node { /** @internal */ export abstract class BaseTokenObject extends BaseSyntaxObject { - // NOTE: Tokens generally do not have or need emitNode entries, so they are declared and not defined to reduce + // NOTE: Tokens generally do not have or need emitNode entries, so they are declared but not defined to reduce // memory footprint. declare emitNode: EmitNode | undefined; + // NOTE: Tokens cannot have modifiers, so they are declared but not defined to reduce memory footprint + declare modifierFlagsCache: ModifierFlags; override forEachChild(_cbNode: (node: Node) => T, _cbNodeArray?: (nodes: NodeArray) => T): T | undefined { // Tokens cannot have source element children @@ -224,8 +225,8 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { escapedText: __String = "" as __String; symbol: Symbol = undefined!; // initialized by checker - jsDoc: JSDoc[] | undefined = undefined; // initialized by parser (JsDocContainer) - flowNode: FlowNode | undefined = undefined; // initialized by binder (FlowContainer) + jsDoc?: JSDoc[] = undefined; // initialized by parser (JsDocContainer) + flowNode?: FlowNode = undefined; // initialized by binder (FlowContainer) get text(): string { return idText(this); @@ -260,6 +261,8 @@ export class PrivateIdentifierObject extends BaseTokenObject implements PrivateI export abstract class BaseNodeObject extends BaseSyntaxObject { // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. override emitNode: EmitNode | undefined = undefined; + // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism + override modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` override forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { return forEachChild(this, cbNode, cbNodeArray); @@ -292,7 +295,7 @@ export abstract class BaseNodeObject extends BaseSyntaxObject { return undefined; } - const child = findLast(children, child => child.kind < SyntaxKind.FirstJSDocNode || child.kind > SyntaxKind.LastJSDocNode); + const child = lastOrUndefined(children); if (!child) { return undefined; } @@ -328,57 +331,57 @@ export class SourceFileObject extends BaseNodeObject implements SourceFile { declare text: string; declare resolvedPath: Path; declare originalFileName: string; - declare redirectInfo?: RedirectInfo | undefined; + declare redirectInfo?: RedirectInfo; declare amdDependencies: readonly AmdDependency[]; - declare moduleName?: string | undefined; + declare moduleName?: string; declare referencedFiles: readonly FileReference[]; declare typeReferenceDirectives: readonly FileReference[]; declare libReferenceDirectives: readonly FileReference[]; declare languageVariant: LanguageVariant; declare isDeclarationFile: boolean; - declare renamedDependencies?: ReadonlyMap | undefined; + declare renamedDependencies?: ReadonlyMap; declare hasNoDefaultLib: boolean; declare languageVersion: ScriptTarget; declare impliedNodeFormat?: ResolutionMode; - declare packageJsonLocations?: readonly string[] | undefined; - declare packageJsonScope?: PackageJsonInfo | undefined; + declare packageJsonLocations?: readonly string[]; + declare packageJsonScope?: PackageJsonInfo; declare scriptKind: ScriptKind; - declare externalModuleIndicator?: true | Node | undefined; - declare setExternalModuleIndicator?: ((file: SourceFile) => void) | undefined; - declare commonJsModuleIndicator?: Node | undefined; - declare jsGlobalAugmentations?: SymbolTable | undefined; + declare externalModuleIndicator?: true | Node; + declare setExternalModuleIndicator?: (file: SourceFile) => void; + declare commonJsModuleIndicator?: Node; + declare jsGlobalAugmentations?: SymbolTable; declare identifiers: ReadonlyMap; declare nodeCount: number; declare identifierCount: number; declare symbolCount: number; declare parseDiagnostics: DiagnosticWithLocation[]; declare bindDiagnostics: DiagnosticWithLocation[]; - declare bindSuggestionDiagnostics?: DiagnosticWithLocation[] | undefined; - declare jsDocDiagnostics?: DiagnosticWithLocation[] | undefined; - declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[] | undefined; + declare bindSuggestionDiagnostics?: DiagnosticWithLocation[]; + declare jsDocDiagnostics?: DiagnosticWithLocation[]; + declare additionalSyntacticDiagnostics?: readonly DiagnosticWithLocation[]; declare lineMap: readonly number[]; - declare classifiableNames?: ReadonlySet<__String> | undefined; - declare commentDirectives?: CommentDirective[] | undefined; - declare resolvedModules?: ModeAwareCache | undefined; - declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache | undefined; + declare classifiableNames?: ReadonlySet<__String>; + declare commentDirectives?: CommentDirective[]; + declare resolvedModules?: ModeAwareCache; + declare resolvedTypeReferenceDirectiveNames?: ModeAwareCache; declare imports: readonly StringLiteralLike[]; declare moduleAugmentations: readonly (Identifier | StringLiteral)[]; - declare patternAmbientModules?: PatternAmbientModule[] | undefined; + declare patternAmbientModules?: PatternAmbientModule[]; declare ambientModuleNames: readonly string[]; - declare checkJsDirective?: CheckJsDirective | undefined; + declare checkJsDirective?: CheckJsDirective; declare version: string; declare pragmas: ReadonlyPragmaMap; - declare localJsxNamespace?: __String | undefined; - declare localJsxFragmentNamespace?: __String | undefined; - declare localJsxFactory?: EntityName | undefined; - declare localJsxFragmentFactory?: EntityName | undefined; - declare endFlowNode?: FlowNode | undefined; + declare localJsxNamespace?: __String; + declare localJsxFragmentNamespace?: __String; + declare localJsxFactory?: EntityName; + declare localJsxFragmentFactory?: EntityName; + declare endFlowNode?: FlowNode; declare symbol: Symbol; - declare localSymbol?: Symbol | undefined; + declare localSymbol?: Symbol; declare modifierFlagsCache: ModifierFlags; declare transformFlags: TransformFlags; - declare locals?: SymbolTable | undefined; - declare nextContainer?: HasLocals | undefined; + declare locals?: SymbolTable; + declare nextContainer?: HasLocals; declare scriptSnapshot: IScriptSnapshot; declare nameTable: UnderscoreEscapedMap | undefined; @@ -655,6 +658,7 @@ function createSyntaxList(nodes: NodeArray, parent: Node): Node { let pos = nodes.pos; for (const node of nodes) { children = addSyntheticNodes(children, pos, node.pos, parent); + children = append(children, node); pos = node.end; } children = addSyntheticNodes(children, pos, nodes.end, parent); diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index 630172aa4f089..1f8c43140b87c 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -46,23 +46,23 @@ import { export class SymbolObject implements Symbol { flags: SymbolFlags = 0; escapedName: __String = "" as __String; - declarations: Declaration[] | undefined = undefined; - valueDeclaration: Declaration | undefined = undefined; + declarations?: Declaration[] = undefined; + valueDeclaration?: Declaration = undefined; id = 0; mergeId = 0; - parent: Symbol | undefined = undefined; - members: SymbolTable | undefined = undefined; - exports: SymbolTable | undefined = undefined; - exportSymbol: Symbol | undefined = undefined; + parent?: Symbol = undefined; + members?: SymbolTable = undefined; + exports?: SymbolTable = undefined; + exportSymbol?: Symbol = undefined; constEnumOnlyModule: boolean | undefined = undefined; - isReferenced: SymbolFlags | undefined = undefined; - lastAssignmentPos: number | undefined = undefined; - links: SymbolLinks | undefined = undefined; // used by TransientSymbol + isReferenced?: SymbolFlags = undefined; + lastAssignmentPos?: number = undefined; + links?: SymbolLinks = undefined; // used by TransientSymbol // TODO: Review these for polymorphism: - declare isReplaceableByMethod?: boolean | undefined; - declare assignmentDeclarationMembers?: Map | undefined; - declare globalExports?: SymbolTable | undefined; + declare isReplaceableByMethod?: boolean; + declare assignmentDeclarationMembers?: Map; + declare globalExports?: SymbolTable; // TODO: Added by services, review for migration/polymorphism: // documentationComment?: SymbolDisplayPart[]; @@ -122,14 +122,14 @@ export class TypeObject implements Type { // TODO: Review for polymorphism declare id: number; declare symbol: Symbol; - declare pattern?: DestructuringPattern | undefined; - declare aliasSymbol?: Symbol | undefined; - declare aliasTypeArguments?: readonly Type[] | undefined; - declare permissiveInstantiation?: Type | undefined; - declare restrictiveInstantiation?: Type | undefined; - declare uniqueLiteralFilledInstantiation?: Type | undefined; - declare immediateBaseConstraint?: Type | undefined; - declare widened?: Type | undefined; + declare pattern?: DestructuringPattern; + declare aliasSymbol?: Symbol; + declare aliasTypeArguments?: readonly Type[]; + declare permissiveInstantiation?: Type; + declare restrictiveInstantiation?: Type; + declare uniqueLiteralFilledInstantiation?: Type; + declare immediateBaseConstraint?: Type; + declare widened?: Type; constructor(checker: TypeChecker, flags: TypeFlags) { this.flags = flags; @@ -253,31 +253,30 @@ export class SignatureObject implements Signature { checker: TypeChecker; // TODO: Review for polymorphism: - declare declaration?: JSDocSignature | SignatureDeclaration | undefined; - declare typeParameters?: readonly TypeParameter[] | undefined; + declare declaration?: JSDocSignature | SignatureDeclaration; + declare typeParameters?: readonly TypeParameter[]; declare parameters: readonly Symbol[]; - declare thisParameter?: Symbol | undefined; - declare resolvedReturnType?: Type | undefined; - declare resolvedTypePredicate?: TypePredicate | undefined; + declare thisParameter?: Symbol; + declare resolvedReturnType?: Type; + declare resolvedTypePredicate?: TypePredicate; declare minArgumentCount: number; - declare resolvedMinArgumentCount?: number | undefined; - declare target?: Signature | undefined; - declare mapper?: TypeMapper | undefined; - declare compositeSignatures?: Signature[] | undefined; - declare compositeKind?: TypeFlags | undefined; - declare erasedSignatureCache?: Signature | undefined; - declare canonicalSignatureCache?: Signature | undefined; - declare baseSignatureCache?: Signature | undefined; - declare optionalCallSignatureCache?: { inner?: Signature | undefined; outer?: Signature | undefined; } | undefined; - declare isolatedSignatureType?: ObjectType | undefined; - declare instantiations?: Map | undefined; + declare resolvedMinArgumentCount?: number; + declare target?: Signature; + declare mapper?: TypeMapper; + declare compositeSignatures?: Signature[]; + declare compositeKind?: TypeFlags; + declare erasedSignatureCache?: Signature; + declare canonicalSignatureCache?: Signature; + declare baseSignatureCache?: Signature; + declare optionalCallSignatureCache?: { inner?: Signature; outer?: Signature; }; + declare isolatedSignatureType?: ObjectType; + declare instantiations?: Map; // TODO: Added by services, review for migration/polymorhpism: // documentationComment?: SymbolDisplayPart[]; // jsDocTags?: JSDocTagInfo[]; // same constructor(checker: TypeChecker, flags: SignatureFlags) { - // TODO: stabilize map this.flags = flags; this.checker = checker; } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1b8d85d0646bd..57c5a2ed23f63 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -928,8 +928,8 @@ export interface Node extends ReadonlyTextRange { /** @internal */ readonly transformFlags: TransformFlags; // Flags for transforms /** @internal */ id?: NodeId; // Unique id (used to look up NodeLinks) readonly parent: Node; // Parent node (initialized by binding) - /** @internal */ original?: Node; // The original node if this is an updated node. - /** @internal */ emitNode?: EmitNode; // Associated EmitNode (initialized by transforms) + /** @internal */ original?: Node | undefined; // The original node if this is an updated node. + /** @internal */ emitNode?: EmitNode | undefined; // Associated EmitNode (initialized by transforms) // NOTE: `symbol` and `localSymbol` have been moved to `Declaration` // `locals` and `nextContainer` have been moved to `LocalsContainer` // `flowNode` has been moved to `FlowContainer` @@ -8940,7 +8940,7 @@ export interface NodeFactory { // Synthetic Nodes // /** @internal */ createSyntheticExpression(type: Type, isSpread?: boolean, tupleNameSource?: ParameterDeclaration | NamedTupleMember): SyntheticExpression; - /** @internal */ createSyntaxList(children: Node[]): SyntaxList; + /** @internal */ createSyntaxList(children: readonly Node[]): SyntaxList; // // Transformation nodes diff --git a/src/services/smartSelection.ts b/src/services/smartSelection.ts index d1cc5ca92472b..d726d177e682a 100644 --- a/src/services/smartSelection.ts +++ b/src/services/smartSelection.ts @@ -279,7 +279,7 @@ function getSelectionChildren(node: Node): readonly Node[] { * Groups sibling nodes together into their own SyntaxList if they * a) are adjacent, AND b) match a predicate function. */ -function groupChildren(children: Node[], groupOn: (child: Node) => boolean): Node[] { +function groupChildren(children: readonly Node[], groupOn: (child: Node) => boolean): Node[] { const result: Node[] = []; let group: Node[] | undefined; for (const child of children) { @@ -315,7 +315,7 @@ function groupChildren(children: Node[], groupOn: (child: Node) => boolean): Nod * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate * child rather than be included in the right-hand group. */ -function splitChildren(children: Node[], pivotOn: (child: Node) => boolean, separateTrailingSemicolon = true): Node[] { +function splitChildren(children: readonly Node[], pivotOn: (child: Node) => boolean, separateTrailingSemicolon = true): readonly Node[] { if (children.length < 2) { return children; } @@ -336,7 +336,7 @@ function splitChildren(children: Node[], pivotOn: (child: Node) => boolean, sepa return separateLastToken ? result.concat(lastToken) : result; } -function createSyntaxList(children: Node[]): SyntaxList { +function createSyntaxList(children: readonly Node[]): SyntaxList { Debug.assertGreaterThanOrEqual(children.length, 1); return setTextRangePosEnd(parseNodeFactory.createSyntaxList(children), children[0].pos, last(children).end); } diff --git a/src/services/types.ts b/src/services/types.ts index 0c5ad370d2f80..964131e077b99 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -63,9 +63,9 @@ declare module "../compiler/types" { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; + getChildren(sourceFile?: SourceFile): readonly Node[]; /** @internal */ - getChildren(sourceFile?: SourceFileLike): Node[]; // eslint-disable-line @typescript-eslint/unified-signatures + getChildren(sourceFile?: SourceFileLike): readonly Node[]; // eslint-disable-line @typescript-eslint/unified-signatures getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; /** @internal */ getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 061aa121734e7..d3af9d2cf1485 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -1820,7 +1820,7 @@ function findRightmostToken(n: Node, sourceFile: SourceFileLike): Node | undefin /** * Finds the rightmost child to the left of `children[exclusiveStartPosition]` which is a non-all-whitespace token or has constituent tokens. */ -function findRightmostChildNodeWithTokens(children: Node[], exclusiveStartPosition: number, sourceFile: SourceFileLike, parentKind: SyntaxKind): Node | undefined { +function findRightmostChildNodeWithTokens(children: readonly Node[], exclusiveStartPosition: number, sourceFile: SourceFileLike, parentKind: SyntaxKind): Node | undefined { for (let i = exclusiveStartPosition - 1; i >= 0; i--) { const child = children[i]; diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json index 43eda754b033f..919a131de8b1f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 54, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 52, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index 3c8c7deed7ca5..d89d96f443a7b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -3,23 +3,23 @@ "pos": 0, "end": 674, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": { "0": { "kind": "JSDocText", "pos": 0, "end": 7, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "" }, "1": { "kind": "JSDocLink", "pos": 7, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 14, @@ -33,16 +33,16 @@ "kind": "JSDocText", "pos": 21, "end": 32, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "\nInside " }, "3": { "kind": "JSDocLink", "pos": 32, "end": 49, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 39, @@ -56,8 +56,8 @@ "kind": "JSDocText", "pos": 49, "end": 59, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " thing" }, "length": 5, @@ -71,8 +71,8 @@ "kind": "JSDocParameterTag", "pos": 59, "end": 102, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 60, @@ -85,22 +85,22 @@ "kind": "JSDocText", "pos": 70, "end": 79, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "See also " }, "1": { "kind": "JSDocLink", "pos": 79, "end": 98, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "QualifiedName", "pos": 86, "end": 97, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 86, @@ -138,8 +138,8 @@ "kind": "JSDocParameterTag", "pos": 102, "end": 589, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 103, @@ -152,16 +152,16 @@ "kind": "JSDocText", "pos": 113, "end": 120, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Or see " }, "1": { "kind": "JSDocLink", "pos": 120, "end": 152, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 127, @@ -175,22 +175,22 @@ "kind": "JSDocText", "pos": 152, "end": 156, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "\n" }, "3": { "kind": "JSDocLink", "pos": 156, "end": 183, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "QualifiedName", "pos": 163, "end": 181, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 163, @@ -212,32 +212,32 @@ "kind": "JSDocText", "pos": 183, "end": 203, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "\nThis empty one: " }, "5": { "kind": "JSDocLink", "pos": 203, "end": 210, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "" }, "6": { "kind": "JSDocText", "pos": 210, "end": 244, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " is OK.\nThis double-space one: " }, "7": { "kind": "JSDocLink", "pos": 244, "end": 262, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 252, @@ -251,22 +251,22 @@ "kind": "JSDocText", "pos": 262, "end": 326, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " is OK too.\nThis should work, despite being badly formatted: " }, "9": { "kind": "JSDocLink", "pos": 326, "end": 340, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "QualifiedName", "pos": 333, "end": 338, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 333, @@ -288,16 +288,16 @@ "kind": "JSDocText", "pos": 340, "end": 369, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "\nForgot to close this one " }, "11": { "kind": "JSDocLink", "pos": 369, "end": 403, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 376, @@ -311,24 +311,24 @@ "kind": "JSDocText", "pos": 403, "end": 526, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: " }, "13": { "kind": "JSDocLink", "pos": 526, "end": 541, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "* nope" }, "14": { "kind": "JSDocText", "pos": 541, "end": 589, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " * }, because of the intermediate asterisks." }, "length": 15, @@ -351,8 +351,8 @@ "kind": "JSDocAuthorTag", "pos": 589, "end": 672, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 590, @@ -365,24 +365,24 @@ "kind": "JSDocText", "pos": 597, "end": 624, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Alfa Romero " }, "1": { "kind": "JSDocText", "pos": 624, "end": 643, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": " See my home page: " }, "2": { "kind": "JSDocLink", "pos": 643, "end": 670, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 650, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json index 63235aa838560..b9af20f3a7e83 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json @@ -3,15 +3,15 @@ "pos": 0, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTag", "pos": 3, "end": 6, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 4, @@ -24,8 +24,8 @@ "kind": "JSDocTag", "pos": 6, "end": 9, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -38,8 +38,8 @@ "kind": "JSDocTag", "pos": 9, "end": 11, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 10, @@ -52,8 +52,8 @@ "kind": "JSDocTag", "pos": 11, "end": 13, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 12, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json index de101a9765ca2..3e5b19e28441e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json @@ -3,7 +3,7 @@ "pos": 0, "end": 21, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "bill@example.com" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json index 46750c7368b32..db78d23e94b57 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json @@ -3,7 +3,7 @@ "pos": 0, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "*@a" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json index 894e629dcec29..6c185b409f3f3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json @@ -3,16 +3,16 @@ "pos": 0, "end": 9, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "*", "tags": { "0": { "kind": "JSDocTag", "pos": 5, "end": 7, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 841f9518ce91b..0b514682bff8d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -3,15 +3,15 @@ "pos": 0, "end": 66, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 6, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -24,21 +24,21 @@ "kind": "JSDocTypeExpression", "pos": 34, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "JSDocTypeLiteral", "pos": 34, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "jsDocPropertyTags": { "0": { "kind": "JSDocParameterTag", "pos": 34, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 35, @@ -51,8 +51,8 @@ "kind": "JSDocTypeExpression", "pos": 41, "end": 49, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "StringKeyword", "pos": 42, @@ -64,8 +64,8 @@ "kind": "QualifiedName", "pos": 50, "end": 53, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 50, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json index 2f8223590c0e1..62bc32517a3ad 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json @@ -3,7 +3,7 @@ "pos": 0, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "trailing whitespace" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 43a7e2c42cea4..951af06437d40 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 44, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 42, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 13, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index ea59b9c0597a4..2bc870c1ecf05 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 49, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 47, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 18, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 19, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 1339748599cc5..1a21dce3f0beb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -3,16 +3,16 @@ "pos": 0, "end": 23, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "*", "tags": { "0": { "kind": "JSDocTypeTag", "pos": 6, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 12, "end": 20, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 13, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 535a5d4eda7e1..69372d2902068 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 739, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocAuthorTag", "pos": 7, "end": 50, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 8, @@ -24,8 +24,8 @@ "kind": "JSDocText", "pos": 15, "end": 50, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "John Doe " }, "length": 1, @@ -39,8 +39,8 @@ "kind": "JSDocAuthorTag", "pos": 50, "end": 112, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 51, @@ -54,8 +54,8 @@ "kind": "JSDocAuthorTag", "pos": 112, "end": 170, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 113, @@ -69,8 +69,8 @@ "kind": "JSDocAuthorTag", "pos": 170, "end": 227, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 171, @@ -83,8 +83,8 @@ "kind": "JSDocText", "pos": 178, "end": 227, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Multiple Ats " }, "length": 1, @@ -98,8 +98,8 @@ "kind": "JSDocAuthorTag", "pos": 227, "end": 272, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 228, @@ -112,8 +112,8 @@ "kind": "JSDocText", "pos": 235, "end": 272, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Multiple Open Carets " }, "length": 1, @@ -127,8 +127,8 @@ "kind": "JSDocAuthorTag", "pos": 272, "end": 338, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 273, @@ -142,8 +142,8 @@ "kind": "JSDocAuthorTag", "pos": 338, "end": 381, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 339, @@ -156,8 +156,8 @@ "kind": "JSDocText", "pos": 346, "end": 381, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Unclosed Carets " }, "length": 1, @@ -229,8 +229,8 @@ "kind": "JSDocAuthorTag", "pos": 429, "end": 445, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 430, @@ -243,8 +243,8 @@ "kind": "JSDocText", "pos": 437, "end": 445, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Line" }, "length": 1, @@ -258,8 +258,8 @@ "kind": "JSDocAuthorTag", "pos": 445, "end": 453, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 446, @@ -272,8 +272,8 @@ "kind": "JSDocText", "pos": 453, "end": 453, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "" }, "length": 1, @@ -287,8 +287,8 @@ "kind": "JSDocAuthorTag", "pos": 453, "end": 461, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 454, @@ -301,8 +301,8 @@ "kind": "JSDocText", "pos": 461, "end": 461, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "" }, "length": 1, @@ -316,8 +316,8 @@ "kind": "JSDocAuthorTag", "pos": 461, "end": 486, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 462, @@ -330,8 +330,8 @@ "kind": "JSDocText", "pos": 469, "end": 486, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Empty authors" }, "length": 1, @@ -345,8 +345,8 @@ "kind": "JSDocAuthorTag", "pos": 486, "end": 497, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 487, @@ -359,8 +359,8 @@ "kind": "JSDocText", "pos": 497, "end": 497, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "" }, "length": 1, @@ -374,8 +374,8 @@ "kind": "JSDocAuthorTag", "pos": 497, "end": 522, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 498, @@ -388,8 +388,8 @@ "kind": "JSDocText", "pos": 510, "end": 522, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Comments" }, "length": 1, @@ -403,8 +403,8 @@ "kind": "JSDocAuthorTag", "pos": 522, "end": 559, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 523, @@ -417,8 +417,8 @@ "kind": "JSDocText", "pos": 530, "end": 559, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "Early Close Caret > " }, "length": 1, @@ -432,8 +432,8 @@ "kind": "JSDocAuthorTag", "pos": 559, "end": 599, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 560, @@ -447,8 +447,8 @@ "kind": "JSDocTag", "pos": 599, "end": 646, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 600, @@ -462,8 +462,8 @@ "kind": "JSDocAuthorTag", "pos": 646, "end": 737, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 647, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index 33f14ebd36287..aaf9db47d17a1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -3,15 +3,15 @@ "pos": 0, "end": 55, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTag", "pos": 7, "end": 53, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json index 4749058d0c2fc..86a583daecd90 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json @@ -3,6 +3,6 @@ "pos": 0, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, - "transformFlags": 0 + "transformFlags": 0, + "modifierFlagsCache": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json index 8793504cc40a5..d34409f7ff9a8 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 31, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,14 +23,14 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "TypeReference", "pos": 20, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json index 0226b44843ac7..8b871a13b2829 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 45, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 43, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json index a13a8a64c3548..168806d5114e9 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 43, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 41, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,14 +24,14 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "TypeReference", "pos": 20, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json index 817598cb1e86e..23fd85f1d88df 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 35, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 30, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "ImportClause", "pos": 16, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "isTypeOnly": true, "name": { "kind": "Identifier", @@ -38,8 +38,8 @@ "kind": "StringLiteral", "pos": 24, "end": 30, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json index d11fa4eb24320..32c04e5a14e2a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 39, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 34, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,22 +23,22 @@ "kind": "ImportClause", "pos": 16, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "isTypeOnly": true, "namedBindings": { "kind": "NamedImports", "pos": 16, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "elements": { "0": { "kind": "ImportSpecifier", "pos": 17, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "isTypeOnly": false, "name": { "kind": "Identifier", @@ -60,8 +60,8 @@ "kind": "StringLiteral", "pos": 28, "end": 34, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json index a34c07e9983a9..8326aa9845967 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 42, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 37, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,15 +23,15 @@ "kind": "ImportClause", "pos": 16, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "isTypeOnly": true, "namedBindings": { "kind": "NamespaceImport", "pos": 16, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 20, @@ -45,8 +45,8 @@ "kind": "StringLiteral", "pos": 31, "end": 37, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json index e60e392ffb8eb..69553de71532d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json @@ -3,15 +3,15 @@ "pos": 0, "end": 55, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 53, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,15 +24,15 @@ "kind": "ImportClause", "pos": 16, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "isTypeOnly": true, "namedBindings": { "kind": "NamespaceImport", "pos": 16, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 20, @@ -46,8 +46,8 @@ "kind": "StringLiteral", "pos": 31, "end": 37, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json index 97a20f5e74726..4852bf39e48f4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index a78806d2b35f3..5f9db72ddb4f0 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -3,15 +3,15 @@ "pos": 0, "end": 61, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 59, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json index 59070fd2c0fdc..4a8d426623de8 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 91, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 8, @@ -34,8 +34,8 @@ "kind": "JSDocParameterTag", "pos": 29, "end": 50, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 30, @@ -58,8 +58,8 @@ "kind": "JSDocTag", "pos": 50, "end": 62, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 51, @@ -72,8 +72,8 @@ "kind": "JSDocTag", "pos": 62, "end": 89, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 63, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json index 97a20f5e74726..4852bf39e48f4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json index 018ca969d65ef..dac2baf7ac524 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json @@ -3,15 +3,15 @@ "pos": 0, "end": 20, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 18, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json index 25d525efd7f8a..248ff0c6c6c2b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 34, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 32, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 734e99b221f30..05dc06dba09a3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 59, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 57, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index 8a9e7fb352a3f..ece7ca43da26d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 61, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 59, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 020b0d9437b72..4eb09d521218a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 66, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 64, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json index a4ae7884303dc..066400ca0dbde 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 34, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 32, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 21, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 29ed1f1a29aba..8807f66c58842 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 46, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 44, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 21, "end": 29, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json index 132a4ef44e978..9434b0c795110 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json @@ -3,15 +3,15 @@ "pos": 0, "end": 23, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json index d3951a55fac41..cfea1e2c90b97 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 29, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 27, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 24, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index 5e7639ebc993c..4345b69cf54cc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 54, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 52, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 24, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json index b405df418d610..dbc58a03bde8f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 30, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 28, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 17, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 18, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json index 5a5a5dfa77084..22a41192ad456 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 32, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocSatisfiesTag", "pos": 8, "end": 30, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 27, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json index 468ab95cf8113..5a0da5822a73d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 24, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json index 814468541c5d4..41eca0c7bce67 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 24, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 20, "end": 21, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json index c8d415e13ed27..94336d1986d63 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 21, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 21, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json index c8d415e13ed27..94336d1986d63 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 21, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 21, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json index 516c270f81ae7..1caaa65bbbc46 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json @@ -3,15 +3,15 @@ "pos": 0, "end": 28, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 22, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index 754b96d70281d..a5eabb5e2f5bc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -3,15 +3,15 @@ "pos": 0, "end": 60, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 58, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -25,8 +25,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 18, @@ -39,8 +39,8 @@ "kind": "TypeParameter", "pos": 22, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index dc02383e4217e..fe92f2b77f734 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -3,7 +3,7 @@ "pos": 0, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "comment": "*" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json index f1e04949611cd..eef6a47cfe579 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 28, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 26, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,14 +23,14 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "TypeReference", "pos": 17, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json index c57a789553db3..acdbbc5651824 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 42, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 40, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json index dc6e605dc95b1..20b148eb9d16b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 40, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 38, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,14 +24,14 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "TypeReference", "pos": 17, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json index bb16558e5f9e6..323047bd616dd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 60, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 34, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, @@ -46,8 +46,8 @@ "kind": "JSDocParameterTag", "pos": 34, "end": 58, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 35, @@ -59,8 +59,8 @@ "kind": "JSDocTypeExpression", "pos": 41, "end": 49, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 42, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json index a3b5ddaca61cc..f4da374f163f7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json @@ -3,15 +3,15 @@ "pos": 0, "end": 56, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 30, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 16, @@ -46,8 +46,8 @@ "kind": "JSDocParameterTag", "pos": 30, "end": 54, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 31, @@ -59,8 +59,8 @@ "kind": "JSDocTypeExpression", "pos": 37, "end": 45, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 38, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json index 97a20f5e74726..4852bf39e48f4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json index dff2bb63fa7c4..6651ab40ac97e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json @@ -3,15 +3,15 @@ "pos": 0, "end": 102, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tags": { "0": { "kind": "JSDocTypedefTag", "pos": 8, "end": 100, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,15 +23,15 @@ "kind": "JSDocTypeLiteral", "pos": 8, "end": 100, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "jsDocPropertyTags": { "0": { "kind": "JSDocPropertyTag", "pos": 47, "end": 74, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 48, @@ -43,8 +43,8 @@ "kind": "JSDocTypeExpression", "pos": 57, "end": 65, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 58, @@ -66,8 +66,8 @@ "kind": "JSDocPropertyTag", "pos": 74, "end": 100, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "tagName": { "kind": "Identifier", "pos": 75, @@ -79,8 +79,8 @@ "kind": "JSDocTypeExpression", "pos": 84, "end": 92, - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "StringKeyword", "pos": 85, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json index b4e63a7851903..852fffaf54b58 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json @@ -3,6 +3,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, - "transformFlags": 0 + "transformFlags": 0, + "modifierFlagsCache": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json index 4b4f64ff69668..301306828a307 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json @@ -3,15 +3,15 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elementType": { "kind": "TypeReference", "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json index c88cf10efeacc..fd333db7d03f1 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json @@ -3,22 +3,22 @@ "pos": 1, "end": 6, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elementType": { "kind": "ArrayType", "pos": 1, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elementType": { "kind": "TypeReference", "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json index e723a54556955..c599013c9850e 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json @@ -3,36 +3,36 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "ParenthesizedType", "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "ArrayType", "pos": 2, "end": 7, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elementType": { "kind": "ArrayType", "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elementType": { "kind": "TypeReference", "pos": 2, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json index edc12f8f0b791..006e2d670273b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "CallSignature", "pos": 2, "end": 12, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "length": 0, "pos": 3, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json index 3ec8a590dcdeb..8e4313fa50202 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "StringKeyword", "pos": 10, @@ -26,8 +26,8 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "BooleanKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json index ed1f75ffcb8c6..c3e8f069c798c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "parameters": { "length": 0, "pos": 10, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json index 3ec8a590dcdeb..8e4313fa50202 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json @@ -3,16 +3,16 @@ "pos": 1, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "StringKeyword", "pos": 10, @@ -26,8 +26,8 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "BooleanKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json index 9ee95f4db14bc..8c57c623a3104 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json @@ -3,23 +3,23 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "TypeReference", "pos": 10, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 10, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json index d3c1a9b1472a7..07667f7cb74ac 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json index eaf113206ee58..846352917a9d8 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "literal": { "kind": "NullKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json index 2585696a6bf43..f0a84fbbfaffa 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "MethodSignature", "pos": 2, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json index a2f84428ced0e..743e8d7dda862 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 10, @@ -26,15 +26,15 @@ "pos": 14, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "QualifiedName", "pos": 14, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json index 0c26ec3833ddf..7d149f05e77e8 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json index b04300a23ad17..08cae8823aa38 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json index f8bf5398d90db..934a9af4d23bb 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json index f5a665639c52b..30751e5bbee1f 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json index 63ca227cb6028..b6c7103ea77aa 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json @@ -3,14 +3,14 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "JSDocUnknownType", "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, - "transformFlags": 0 + "transformFlags": 0, + "modifierFlagsCache": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json index 292b0f4455123..5e8e08b08d3ee 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json index f43b1bdac1823..9b26032ed1aec 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json index b861870f7086f..efc4788e110e5 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json @@ -3,16 +3,16 @@ "pos": 1, "end": 6, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json index 557652828a4be..21bae58b1f627 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json @@ -3,16 +3,16 @@ "pos": 1, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json index 75977d52d6bb2..ab34634c5dcb2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json @@ -3,16 +3,16 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 6, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, @@ -27,8 +27,8 @@ "pos": 6, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json index 00a156444e6c4..949a216767e50 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, @@ -34,8 +34,8 @@ "pos": 14, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json index 4c1c1c15488d9..fe1d995cb9310 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 6, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, @@ -27,8 +27,8 @@ "pos": 6, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json index 7d56586d4752d..18f75e0840c55 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json @@ -3,16 +3,16 @@ "pos": 1, "end": 27, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, @@ -34,8 +34,8 @@ "pos": 14, "end": 26, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json index e3668abcbb6b6..2b1cbe916e06b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json @@ -3,16 +3,16 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json index ddb591f737c63..4b28545356ea2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 10, @@ -26,15 +26,15 @@ "pos": 15, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "QualifiedName", "pos": 15, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json index 89842c75b8732..0d655b88b677f 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 14, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json index 12befdc648503..5acc58cf56828 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 5, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json index 3470d4cd8ac7c..fd9e8e64c042b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 17, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "length": 0, "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json index eeb1dc9dc1bac..7c8db2b2ca0a2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "parameters": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json index d4edc50f085dd..de95c536972d8 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json @@ -3,8 +3,8 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elements": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json index 3720475c1f498..1a3e3f7af0598 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json index 91d44edea9e43..9823792b1cffc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json index de7e4268e2509..54938946ab3df 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json @@ -3,8 +3,8 @@ "pos": 1, "end": 24, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json index 3da3449148ff0..72c6fb41390a0 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json @@ -3,8 +3,8 @@ "pos": 1, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json index 4c703947ea262..3a66cd5a41113 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json @@ -3,8 +3,8 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json index a04f845079020..ab170167fd78c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "exprName": { "kind": "Identifier", "pos": 7, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json index 647246c631010..11251cbe4cd05 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json index 5e738719c513d..786344ade9837 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 18, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json index 117fad0686e2c..834041ea8ae8e 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json @@ -3,15 +3,15 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "typeName": { "kind": "QualifiedName", "pos": 1, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "left": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json index 93be2ef86cd5b..c1dc136d57727 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json @@ -3,15 +3,15 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "UnionType", "pos": 2, "end": 15, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json index 1238bc87c974d..8d95996f80a9c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json @@ -3,15 +3,15 @@ "pos": 1, "end": 22, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "UnionType", "pos": 2, "end": 20, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json index d013dcf9fa55c..d0d61b07993f0 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json @@ -3,15 +3,15 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "type": { "kind": "UnionType", "pos": 2, "end": 11, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 1, + "modifierFlagsCache": 0, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json index b68503ba281ca..e3b445d9a39cf 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json @@ -3,6 +3,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "modifierFlagsCache": 0, - "transformFlags": 0 + "transformFlags": 0, + "modifierFlagsCache": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json index 6ec84fc8faba2..1a2ecb1254563 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 10, "flags": "JSDoc", - "modifierFlagsCache": 0, "transformFlags": 0, + "modifierFlagsCache": 0, "type": { "kind": "NumberKeyword", "pos": 4, diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index cc197f83cb542..76aa65dceae14 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4215,7 +4215,7 @@ declare namespace ts { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): Node[]; + getChildren(sourceFile?: SourceFile): readonly Node[]; getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; getFullStart(): number; getEnd(): number; diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff index c50da716b91b9..3ec387bbcc392 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff @@ -7,8 +7,8 @@ "pos": 0, "end": 46, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -39,42 +38,9 @@ @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff index f63d4526fd75c..adfdb448a17e1 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff @@ -7,8 +7,8 @@ "pos": 0, "end": 46, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -39,42 +38,9 @@ @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -61,8 +61,8 @@ "pos": 61, "end": 135, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -137,43 +102,9 @@ @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff index 567ff8973d13a..bdc677387f4ac 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff @@ -7,8 +7,8 @@ "pos": 0, "end": 46, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -39,42 +38,9 @@ @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -61,8 +61,8 @@ "pos": 61, "end": 135, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -137,43 +102,9 @@ @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff index 852412d8420f3..b19a65a11ebc7 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff @@ -7,8 +7,8 @@ "pos": 0, "end": 46, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -39,42 +38,9 @@ @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -61,8 +61,8 @@ "pos": 61, "end": 135, - "flags": "Deprecated", - "modifierFlagsCache": 0, "transformFlags": 4194304, + "modifierFlagsCache": 0, "name": { "kind": "Identifier", @@ -137,43 +102,9 @@ @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff index 0c2bff5a4677e..08154919e963e 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 43, diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff index 3a1028bb08254..78347a23adcef 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 43, diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff index 41135dc2495ba..1e73fbe1152c9 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 43, diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff index 277a3fbe56a55..1c1a4fddf275a 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 94, diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff index cae5537d772c6..8bc6eacc33105 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 94, diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff index d89f8511e680a..1ffd8d88f2dcd 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "modifierFlagsCache": 0, - "transformFlags": 0, +- "modifierFlagsCache": 0, - "name": { - "kind": "Identifier", - "pos": 94, From 77ac7533f9269ac3e520a56ecbc189131609a74f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 20:16:20 -0400 Subject: [PATCH 10/24] Migrate additional Node/Symbol/etc. methods from services to compiler --- src/compiler/objectConstructors.ts | 23 ++-- src/compiler/types.ts | 155 ++++++++++++++++++---- src/services/services.ts | 99 +++++++------- src/services/types.ts | 201 +---------------------------- 4 files changed, 196 insertions(+), 282 deletions(-) diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index 1f8c43140b87c..fe5d9381b43e1 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -13,13 +13,13 @@ import { IntersectionType, isThisTypeParameter, JSDocSignature, + JSDocTagInfo, LineAndCharacter, LiteralType, Node, NumberLiteralType, ObjectFlags, ObjectType, - ServicesForwardRefArray, Signature, SignatureDeclaration, SignatureFlags, @@ -27,6 +27,7 @@ import { SourceMapSource, StringLiteralType, Symbol, + SymbolDisplayPart, SymbolFlags, SymbolLinks, symbolName, @@ -97,20 +98,20 @@ export class SymbolObject implements Symbol { return this.declarations; } - getDocumentationComment(_checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> { - throw new TypeError("Not supported"); + getDocumentationComment(_checker: TypeChecker | undefined): SymbolDisplayPart[] { + throw new TypeError("Not implemented."); } - getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"SymbolDisplayPart"> { - throw new TypeError("Not supported"); + getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): SymbolDisplayPart[] { + throw new TypeError("Not implemented."); } - getJsDocTags(_checker?: TypeChecker): ServicesForwardRefArray<"JSDocTagInfo"> { - throw new TypeError("Not supported"); + getJsDocTags(_checker?: TypeChecker): JSDocTagInfo[] { + throw new TypeError("Not implemented."); } - getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): ServicesForwardRefArray<"JSDocTagInfo"> { - throw new TypeError("Not supported"); + getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): JSDocTagInfo[] { + throw new TypeError("Not implemented."); } } @@ -308,11 +309,11 @@ export class SignatureObject implements Signature { return type; } - getDocumentationComment(): ServicesForwardRefArray<"SymbolDisplayPart"> { + getDocumentationComment(): SymbolDisplayPart[] { throw new TypeError("Not implemented"); } - getJsDocTags(): ServicesForwardRefArray<"JSDocTagInfo"> { + getJsDocTags(): JSDocTagInfo[] { throw new TypeError("Not implemented"); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 57c5a2ed23f63..82b080bc6ef22 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -934,6 +934,31 @@ export interface Node extends ReadonlyTextRange { // `locals` and `nextContainer` have been moved to `LocalsContainer` // `flowNode` has been moved to `FlowContainer` // see: https://github.com/microsoft/TypeScript/pull/51682 + + getSourceFile(): SourceFile; + getChildCount(sourceFile?: SourceFile): number; + getChildAt(index: number, sourceFile?: SourceFile): Node; + getChildren(sourceFile?: SourceFile): readonly Node[]; + /** @internal */ + getChildren(sourceFile?: SourceFileLike): readonly Node[]; // eslint-disable-line @typescript-eslint/unified-signatures + getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; + /** @internal */ + getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures + getFullStart(): number; + getEnd(): number; + getWidth(sourceFile?: SourceFileLike): number; + getFullWidth(): number; + getLeadingTriviaWidth(sourceFile?: SourceFile): number; + getFullText(sourceFile?: SourceFile): string; + getText(sourceFile?: SourceFile): string; + getFirstToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + getLastToken(sourceFile?: SourceFile): Node | undefined; + /** @internal */ + getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures + // See ts.forEachChild for documentation. + forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; } export interface JSDocContainer extends Node { @@ -1677,6 +1702,7 @@ export interface Identifier extends PrimaryExpression, Declaration, JSDocContain * Text of identifier, but if the identifier begins with two underscores, this will begin with three. */ readonly escapedText: __String; + readonly text: string; } // Transient identifier node (marked by id === -1) @@ -1770,6 +1796,7 @@ export interface PrivateIdentifier extends PrimaryExpression { // escaping not strictly necessary // avoids gotchas in transforms and utils readonly escapedText: __String; + readonly text: string; } /** @internal */ @@ -4212,6 +4239,7 @@ export interface SourceFileLike { lineMap?: readonly number[]; /** @internal */ getPositionOfLineAndCharacter?(line: number, character: number, allowEdits?: true): number; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } /** @internal */ @@ -4371,6 +4399,18 @@ export interface SourceFile extends Declaration, LocalsContainer { /** @internal */ endFlowNode?: FlowNode; /** @internal */ jsDocParsingMode?: JSDocParsingMode; + + + /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; + /** @internal */ nameTable: Map<__String, number> | undefined; + /** @internal */ sourceMapper?: DocumentPositionMapper; + /** @internal */ getNamedDeclarations(): Map; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineEndOfPosition(pos: number): number; + getLineStarts(): readonly number[]; + getPositionOfLineAndCharacter(line: number, character: number): number; + update(newText: string, textChangeRange: TextChangeRange): SourceFile; + } /** @@ -5791,6 +5831,45 @@ export const enum SymbolFlags { LateBindingContainer = Class | Interface | TypeLiteral | ObjectLiteral | Function, } +export interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ + text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; +} + +export interface DocumentSpan { + textSpan: TextSpan; + fileName: string; + + /** + * If the span represents a location that was remapped (e.g. via a .d.ts.map file), + * then the original filename and span will be specified here + */ + originalTextSpan?: TextSpan; + originalFileName?: string; + + /** + * If DocumentSpan.textSpan is the span for name of the declaration, + * then this is the span for relevant declaration + */ + contextSpan?: TextSpan; + originalContextSpan?: TextSpan; +} + +export interface JSDocLinkDisplayPart extends SymbolDisplayPart { + target: DocumentSpan; +} + +export interface JSDocTagInfo { + name: string; + text?: SymbolDisplayPart[]; +} + /** @internal */ export type SymbolId = number; @@ -5812,6 +5891,18 @@ export interface Symbol { /** @internal */ lastAssignmentPos?: number; // Source position of last node that assigns value to symbol /** @internal */ isReplaceableByMethod?: boolean; // Can this Javascript class property be replaced by a method symbol? /** @internal */ assignmentDeclarationMembers?: Map; // detected late-bound assignment declarations associated with the symbol + + readonly name: string; + getFlags(): SymbolFlags; + getEscapedName(): __String; + getName(): string; + getDeclarations(): Declaration[] | undefined; + getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc. + /** @internal */ + getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc. + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; // implemented in services, not supported in tsc. + /** @internal */ + getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[]; // implemented in services, not supported in tsc. } // dprint-ignore @@ -6190,6 +6281,32 @@ export interface Type { immediateBaseConstraint?: Type; // Immediate base constraint cache /** @internal */ widened?: Type; // Cached widened form of the type + + getFlags(): TypeFlags; + getSymbol(): Symbol | undefined; + getProperties(): Symbol[]; + getProperty(propertyName: string): Symbol | undefined; + getApparentProperties(): Symbol[]; + getCallSignatures(): readonly Signature[]; + getConstructSignatures(): readonly Signature[]; + getStringIndexType(): Type | undefined; + getNumberIndexType(): Type | undefined; + getBaseTypes(): BaseType[] | undefined; + getNonNullableType(): Type; + /** @internal */ getNonOptionalType(): Type; + /** @internal */ isNullableType(): boolean; + getConstraint(): Type | undefined; + getDefault(): Type | undefined; + isUnion(): this is UnionType; + isIntersection(): this is IntersectionType; + isUnionOrIntersection(): this is UnionOrIntersectionType; + isLiteral(): this is LiteralType; + isStringLiteral(): this is StringLiteralType; + isNumberLiteral(): this is NumberLiteralType; + isTypeParameter(): this is TypeParameter; + isClassOrInterface(): this is InterfaceType; + isClass(): this is InterfaceType; + isIndexType(): this is IndexType; } /** @internal */ @@ -6391,6 +6508,8 @@ export interface TypeReference extends ObjectType { literalType?: TypeReference; // Clone of type with ObjectFlags.ArrayLiteral set /** @internal */ cachedEquivalentBaseType?: Type; // Only set on references to class or interfaces with a single base type and no augmentations + + readonly typeArguments?: readonly Type[]; } export interface DeferredTypeReference extends TypeReference { @@ -6796,6 +6915,14 @@ export interface Signature { instantiations?: Map; // Generic signature instantiation cache /** @internal */ implementationSignatureCache?: Signature; // Copy of the signature with fresh type parameters to use in checking the body of a potentially self-referential generic function (deferred) + + getDeclaration(): JSDocSignature | SignatureDeclaration; + getTypeParameters(): readonly TypeParameter[] | undefined; + getParameters(): readonly Symbol[]; + getTypeParameterAtPosition(pos: number): Type; + getReturnType(): Type; + getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; // implemented in services, not supported in tsc. + getJsDocTags(): JSDocTagInfo[]; // implemented in services, not supported in tsc. } export const enum IndexKind { @@ -7994,6 +8121,7 @@ export interface SourceMapSource { text: string; /** @internal */ lineMap: readonly number[]; skipTrivia?: (pos: number) => number; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } /** @internal */ @@ -10141,30 +10269,3 @@ export interface EvaluationResolver { evaluateEntityNameExpression(expr: EntityNameExpression, location: Declaration | undefined): EvaluatorResult; evaluateElementAccessExpression(expr: ElementAccessExpression, location: Declaration | undefined): EvaluatorResult; } - -/** - * Resolves to a type only when the 'services' project is loaded. Otherwise, results in `never`. - * @internal - */ -export type ServicesOnlyType = ServicesForwardRefs extends { __services: true; } ? T : Fallback; - -/** - * Resolves a forward-reference to a type declared in the 'services' project. - * If 'services' is not present, results in `never`. - * @internal - */ -export type ServicesForwardRef = ServicesForwardRefs extends { [P in K]: infer T; } ? T : never; - -/** - * Resolves a forward-reference to an array of a type declared in the 'services' project. - * If 'services' is not present, results in `never`. - * @internal - */ -export type ServicesForwardRefArray = ServicesOnlyType[]>; - -/** - * A registry of forward references declared in the 'services' project. - * @internal - */ -export interface ServicesForwardRefs { -} diff --git a/src/services/services.ts b/src/services/services.ts index d26a180a46c60..9f9340fab5341 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -265,9 +265,8 @@ import * as classifier2020 from "./classifier2020"; /** The version of the language service API */ export const servicesVersion = "0.8"; -// TODO: Move SymbolInternals to compiler -// Patch Symbol for use with services. -interface SymbolInternals { +// Extra fields added by services are stored in a WeakMap +interface SymbolExtraFields { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; @@ -280,88 +279,96 @@ interface SymbolInternals { contextualSetAccessorTags?: JSDocTagInfo[]; } -ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: (Symbol | TransientSymbol) & SymbolInternals, checker: TypeChecker | undefined): SymbolDisplayPart[] { - if (!this.documentationComment) { - this.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs +const symbolExtraFields = new WeakMap(); + +function ensureSymbolExtraFields(symbol: Symbol) { + let extra = symbolExtraFields.get(symbol); + if (!extra) symbolExtraFields.set(symbol, extra = {}); + return extra; +} + +ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: Symbol | TransientSymbol, checker: TypeChecker | undefined): SymbolDisplayPart[] { + const extra = ensureSymbolExtraFields(this); + if (!extra.documentationComment) { + extra.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) { const labelDecl = this.links.target.links.tupleLabelDeclaration; - this.documentationComment = getDocumentationComment([labelDecl], checker); + extra.documentationComment = getDocumentationComment([labelDecl], checker); } else { - this.documentationComment = getDocumentationComment(this.declarations, checker); + extra.documentationComment = getDocumentationComment(this.declarations, checker); } } - return this.documentationComment; + return extra.documentationComment; }; -ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { +ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { if (context) { + const extra = ensureSymbolExtraFields(this); if (isGetAccessor(context)) { - if (!this.contextualGetAccessorDocumentationComment) { - this.contextualGetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isGetAccessor), checker); - } - if (length(this.contextualGetAccessorDocumentationComment)) { - return this.contextualGetAccessorDocumentationComment; + extra.contextualGetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isGetAccessor), checker); + if (length(extra.contextualGetAccessorDocumentationComment)) { + return extra.contextualGetAccessorDocumentationComment; } } - if (isSetAccessor(context)) { - if (!this.contextualSetAccessorDocumentationComment) { - this.contextualSetAccessorDocumentationComment = getDocumentationComment(filter(this.declarations, isSetAccessor), checker); - } - if (length(this.contextualSetAccessorDocumentationComment)) { - return this.contextualSetAccessorDocumentationComment; + else if (isSetAccessor(context)) { + extra.contextualSetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isSetAccessor), checker); + if (length(extra.contextualSetAccessorDocumentationComment)) { + return extra.contextualSetAccessorDocumentationComment; } } } return this.getDocumentationComment(checker); }; -ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol & SymbolInternals, checker?: TypeChecker): JSDocTagInfo[] { - if (this.tags === undefined) { - this.tags = getJsDocTagsOfDeclarations(this.declarations, checker); - } - - return this.tags; +ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol, checker?: TypeChecker): JSDocTagInfo[] { + const extra = ensureSymbolExtraFields(this); + return extra.tags ??= getJsDocTagsOfDeclarations(this.declarations, checker); }; -ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol & SymbolInternals, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { +ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { if (context) { + const extra = ensureSymbolExtraFields(this); if (isGetAccessor(context)) { - if (!this.contextualGetAccessorTags) { - this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); - } - if (length(this.contextualGetAccessorTags)) { - return this.contextualGetAccessorTags; + extra.contextualGetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); + if (length(extra.contextualGetAccessorTags)) { + return extra.contextualGetAccessorTags; } } - if (isSetAccessor(context)) { - if (!this.contextualSetAccessorTags) { - this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); - } - if (length(this.contextualSetAccessorTags)) { - return this.contextualSetAccessorTags; + else if (isSetAccessor(context)) { + extra.contextualSetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); + if (length(extra.contextualSetAccessorTags)) { + return extra.contextualSetAccessorTags; } } } return this.getJsDocTags(checker); }; -// TODO: Move SignatureInternals to compiler - -interface SignatureInternals { +interface SignatureExtraFields { // Undefined is used to indicate the value has not been computed. If, after computing, the // symbol has no doc comment, then the empty array will be returned. documentationComment?: SymbolDisplayPart[]; jsDocTags?: JSDocTagInfo[]; // same } -ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature & SignatureInternals): SymbolDisplayPart[] { - return this.documentationComment || (this.documentationComment = getDocumentationComment(singleElementArray(this.declaration), this.checker)); +const signatureExtraFields = new WeakMap(); + +function ensureSignatureExtraFields(signature: Signature) { + let extra = signatureExtraFields.get(signature); + if (!extra) signatureExtraFields.set(signature, extra = {}); + return extra; +} + +ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature): SymbolDisplayPart[] { + const extra = ensureSignatureExtraFields(this); + return extra.documentationComment ??= getDocumentationComment(singleElementArray(this.declaration), this.checker); }; -ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature & SignatureInternals): JSDocTagInfo[] { - return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker)); +ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature): JSDocTagInfo[] { + const extra = ensureSignatureExtraFields(this); + return extra.jsDocTags ??= getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker); }; /** diff --git a/src/services/types.ts b/src/services/types.ts index 964131e077b99..f9af89795d234 100644 --- a/src/services/types.ts +++ b/src/services/types.ts @@ -7,6 +7,7 @@ import { DiagnosticWithLocation, DocumentHighlights, DocumentPositionMapper, + DocumentSpan, EmitOutput, ExportInfoMap, ExportMapInfoKey, @@ -16,6 +17,7 @@ import { HasInvalidatedResolutions, IScriptSnapshot, JSDocParsingMode, + JSDocTagInfo, LineAndCharacter, MinimalResolutionCacheHost, ModuleResolutionCache, @@ -36,6 +38,7 @@ import { SourceMapper, StringLiteralLike, Symbol, + SymbolDisplayPart, SymlinkCache, TextChangeRange, textChanges, @@ -44,165 +47,6 @@ import { UserPreferences, } from "./_namespaces/ts"; -declare module "../compiler/types" { - /** - * A registry of forward references declared in the 'services' project. - * @internal - */ - export interface ServicesForwardRefs { - __services: true; - - SymbolDisplayPart: SymbolDisplayPart; - JSDocTagInfo: JSDocTagInfo; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Node { - getSourceFile(): SourceFile; - getChildCount(sourceFile?: SourceFile): number; - getChildAt(index: number, sourceFile?: SourceFile): Node; - getChildren(sourceFile?: SourceFile): readonly Node[]; - /** @internal */ - getChildren(sourceFile?: SourceFileLike): readonly Node[]; // eslint-disable-line @typescript-eslint/unified-signatures - getStart(sourceFile?: SourceFile, includeJsDocComment?: boolean): number; - /** @internal */ - getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number; // eslint-disable-line @typescript-eslint/unified-signatures - getFullStart(): number; - getEnd(): number; - getWidth(sourceFile?: SourceFileLike): number; - getFullWidth(): number; - getLeadingTriviaWidth(sourceFile?: SourceFile): number; - getFullText(sourceFile?: SourceFile): string; - getText(sourceFile?: SourceFile): string; - getFirstToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getFirstToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - getLastToken(sourceFile?: SourceFile): Node | undefined; - /** @internal */ - getLastToken(sourceFile?: SourceFileLike): Node | undefined; // eslint-disable-line @typescript-eslint/unified-signatures - // See ts.forEachChild for documentation. - forEachChild(cbNode: (node: Node) => T | undefined, cbNodeArray?: (nodes: NodeArray) => T | undefined): T | undefined; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Identifier { - readonly text: string; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface PrivateIdentifier { - readonly text: string; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Symbol { - readonly name: string; - getFlags(): SymbolFlags; - getEscapedName(): __String; - getName(): string; - getDeclarations(): Declaration[] | undefined; - getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - /** @internal */ - getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(checker?: TypeChecker): JSDocTagInfo[]; - /** @internal */ - getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[]; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Type { - getFlags(): TypeFlags; - getSymbol(): Symbol | undefined; - getProperties(): Symbol[]; - getProperty(propertyName: string): Symbol | undefined; - getApparentProperties(): Symbol[]; - getCallSignatures(): readonly Signature[]; - getConstructSignatures(): readonly Signature[]; - getStringIndexType(): Type | undefined; - getNumberIndexType(): Type | undefined; - getBaseTypes(): BaseType[] | undefined; - getNonNullableType(): Type; - /** @internal */ getNonOptionalType(): Type; - /** @internal */ isNullableType(): boolean; - getConstraint(): Type | undefined; - getDefault(): Type | undefined; - - isUnion(): this is UnionType; - isIntersection(): this is IntersectionType; - isUnionOrIntersection(): this is UnionOrIntersectionType; - isLiteral(): this is LiteralType; - isStringLiteral(): this is StringLiteralType; - isNumberLiteral(): this is NumberLiteralType; - isTypeParameter(): this is TypeParameter; - isClassOrInterface(): this is InterfaceType; - isClass(): this is InterfaceType; - isIndexType(): this is IndexType; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface TypeReference { - typeArguments?: readonly Type[]; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface Signature { - getDeclaration(): JSDocSignature | SignatureDeclaration; - getTypeParameters(): readonly TypeParameter[] | undefined; - getParameters(): readonly Symbol[]; - getTypeParameterAtPosition(pos: number): Type; - getReturnType(): Type; - getDocumentationComment(typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; - getJsDocTags(): JSDocTagInfo[]; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface SourceFile { - /** @internal */ version: string; - /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; - /** @internal */ nameTable: Map<__String, number> | undefined; - - /** @internal */ getNamedDeclarations(): Map; - - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getLineEndOfPosition(pos: number): number; - getLineStarts(): readonly number[]; - getPositionOfLineAndCharacter(line: number, character: number): number; - update(newText: string, textChangeRange: TextChangeRange): SourceFile; - - /** @internal */ sourceMapper?: DocumentPositionMapper; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface SourceFileLike { - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - } -} - -declare module "../compiler/types" { - // Module transform: converted from interface augmentation - export interface SourceMapSource { - getLineAndCharacterOfPosition(pos: number): LineAndCharacter; - } -} - export namespace ScriptSnapshot { class StringScriptSnapshot implements IScriptSnapshot { constructor(private text: string) { @@ -1023,25 +867,6 @@ export interface TextInsertion { caretOffset: number; } -export interface DocumentSpan { - textSpan: TextSpan; - fileName: string; - - /** - * If the span represents a location that was remapped (e.g. via a .d.ts.map file), - * then the original filename and span will be specified here - */ - originalTextSpan?: TextSpan; - originalFileName?: string; - - /** - * If DocumentSpan.textSpan is the span for name of the declaration, - * then this is the span for relevant declaration - */ - contextSpan?: TextSpan; - originalContextSpan?: TextSpan; -} - export interface RenameLocation extends DocumentSpan { readonly prefixText?: string; readonly suffixText?: string; @@ -1252,26 +1077,6 @@ export enum SymbolDisplayPartKind { linkText, } -export interface SymbolDisplayPart { - /** - * Text of an item describing the symbol. - */ - text: string; - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; -} - -export interface JSDocLinkDisplayPart extends SymbolDisplayPart { - target: DocumentSpan; -} - -export interface JSDocTagInfo { - name: string; - text?: SymbolDisplayPart[]; -} - export interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; From 2b588610ec5561ec59505db0ba27a91b62752ae7 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 20:18:46 -0400 Subject: [PATCH 11/24] PR feedback --- scripts/build/tests.mjs | 2 +- src/compiler/parser.ts | 2 +- src/compiler/types.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build/tests.mjs b/scripts/build/tests.mjs index 9c39ca9ed62ae..47dd96871ca47 100644 --- a/scripts/build/tests.mjs +++ b/scripts/build/tests.mjs @@ -85,7 +85,7 @@ export async function runConsoleTests(runJs, defaultReporter, runInParallel, opt /** @type {string[]} */ const args = []; - // timeout normally isn't necessary but Travis-CI has been timing out on compiler selines occasionally + // timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally // default timeout is 2sec which really should be enough, but maybe we just need a small amount longer if (!runInParallel) { args.push(mochaJs); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 9e0a75bf56c28..0acc708c2c0a7 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1413,7 +1413,7 @@ namespace Parser { var disallowInAndDecoratorContext = NodeFlags.DisallowInContext | NodeFlags.DecoratorContext; - const factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode); + var factory = createNodeFactory(NodeFactoryFlags.NoParenthesizerRules | NodeFactoryFlags.NoNodeConverters | NodeFactoryFlags.NoOriginalNode); var { createNodeArray: factoryCreateNodeArray, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 82b080bc6ef22..6524160947632 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4414,7 +4414,7 @@ export interface SourceFile extends Declaration, LocalsContainer { } /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * Represents an immutable snapshot of a script at a specified time. Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return * the same values. */ From 33d6204dcb2edec9c68fd4d65e0d08bf9b3f3ed3 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 20:36:56 -0400 Subject: [PATCH 12/24] Switch back to instance-only 'kind' fields --- src/compiler/nodeConstructors.ts | 42 ++++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 886b63d7f2204..2be61da47cf8b 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -90,11 +90,7 @@ import { /** @internal */ export abstract class BaseSyntaxObject implements Node { - static { - this.prototype.kind = SyntaxKind.Unknown; - } - declare kind: SyntaxKind; - + kind = SyntaxKind.Unknown; pos = -1; end = -1; id = 0; @@ -106,6 +102,10 @@ export abstract class BaseSyntaxObject implements Node { abstract modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` abstract emitNode: EmitNode | undefined; + constructor(kind: SyntaxKind) { + this.kind = kind; + } + getSourceFile(): SourceFile { return getSourceFileOfNode(this); } @@ -195,19 +195,14 @@ export abstract class BaseTokenObject extends BaseSyntaxObject { /** @internal */ export class TokenObject extends BaseTokenObject implements Token { - override kind: TKind; - + declare kind: TKind; constructor(kind: TKind) { - super(); - this.kind = kind; + super(kind); } } /** @internal */ export class IdentifierObject extends BaseTokenObject implements Identifier { - static { - this.prototype.kind = SyntaxKind.Identifier; - } declare kind: SyntaxKind.Identifier; declare _primaryExpressionBrand: any; @@ -228,6 +223,10 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { jsDoc?: JSDoc[] = undefined; // initialized by parser (JsDocContainer) flowNode?: FlowNode = undefined; // initialized by binder (FlowContainer) + constructor() { + super(SyntaxKind.Identifier); + } + get text(): string { return idText(this); } @@ -235,9 +234,6 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { /** @internal */ export class PrivateIdentifierObject extends BaseTokenObject implements PrivateIdentifier { - static { - PrivateIdentifierObject.prototype.kind = SyntaxKind.PrivateIdentifier; - } declare kind: SyntaxKind.PrivateIdentifier; declare _primaryExpressionBrand: any; @@ -252,6 +248,10 @@ export class PrivateIdentifierObject extends BaseTokenObject implements PrivateI escapedText: __String = "" as __String; + constructor() { + super(SyntaxKind.PrivateIdentifier); + } + get text(): string { return idText(this); } @@ -306,19 +306,15 @@ export abstract class BaseNodeObject extends BaseSyntaxObject { /** @internal */ export class NodeObject extends BaseNodeObject implements Node { - override kind: TKind; + declare kind: TKind; constructor(kind: TKind) { - super(); - this.kind = kind; + super(kind); } } /** @internal */ export class SourceFileObject extends BaseNodeObject implements SourceFile { - static { - this.prototype.kind = SyntaxKind.SourceFile; - } declare kind: SyntaxKind.SourceFile; declare _declarationBrand: any; @@ -387,6 +383,10 @@ export class SourceFileObject extends BaseNodeObject implements SourceFile { declare private namedDeclarations: Map | undefined; + constructor() { + super(SyntaxKind.SourceFile); + } + public update(newText: string, textChangeRange: TextChangeRange): SourceFile { return updateSourceFile(this, newText, textChangeRange); } From bb7688fa19d4904b509c6151a09ec5cdd025f7eb Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 12 Apr 2024 11:44:01 -0400 Subject: [PATCH 13/24] Base method and namespace cleanup --- src/compiler/_namespaces/ts.ts | 4 -- src/compiler/nodeConstructors.ts | 87 ++++++++++++++++---------------- src/services/services.ts | 14 ++--- 3 files changed, 50 insertions(+), 55 deletions(-) diff --git a/src/compiler/_namespaces/ts.ts b/src/compiler/_namespaces/ts.ts index 230138b17e32d..06cd67e20812e 100644 --- a/src/compiler/_namespaces/ts.ts +++ b/src/compiler/_namespaces/ts.ts @@ -75,7 +75,3 @@ import * as moduleSpecifiers from "./ts.moduleSpecifiers"; export { moduleSpecifiers }; import * as performance from "./ts.performance"; export { performance }; -/** @internal */ import * as NodeConstructors from "../nodeConstructors"; -/** @internal */ export { NodeConstructors }; -/** @internal */ import * as ObjectConstructors from "../objectConstructors"; -/** @internal */ export { ObjectConstructors }; diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 2be61da47cf8b..0ad254df8654a 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -159,10 +159,44 @@ export abstract class BaseSyntaxObject implements Node { return this.getChildren(sourceFile)[index]; } - abstract forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined; - abstract getChildren(sourceFile?: SourceFileLike): readonly Node[]; - abstract getFirstToken(sourceFile?: SourceFileLike): Node | undefined; - abstract getLastToken(sourceFile?: SourceFileLike): Node | undefined; + forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + return forEachChild(this, cbNode, cbNodeArray); + } + + getChildren(sourceFile?: SourceFileLike): readonly Node[] { + Debug.assertValidTextRange(this, "Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); + return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile)); + } + + getFirstToken(sourceFile?: SourceFileLike): Node | undefined { + Debug.assertValidTextRange(this); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } + + const child = find(children, child => child.kind < SyntaxKind.FirstJSDocNode || child.kind > SyntaxKind.LastJSDocNode); + if (!child) { + return undefined; + } + + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getFirstToken(sourceFile); + } + + getLastToken(sourceFile?: SourceFileLike): Node | undefined { + Debug.assertValidTextRange(this); + const children = this.getChildren(sourceFile); + if (!children.length) { + return undefined; + } + + const child = lastOrUndefined(children); + if (!child) { + return undefined; + } + + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getLastToken(sourceFile); + } } /** @internal */ @@ -196,6 +230,7 @@ export abstract class BaseTokenObject extends BaseSyntaxObject { /** @internal */ export class TokenObject extends BaseTokenObject implements Token { declare kind: TKind; + constructor(kind: TKind) { super(kind); } @@ -263,45 +298,6 @@ export abstract class BaseNodeObject extends BaseSyntaxObject { override emitNode: EmitNode | undefined = undefined; // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism override modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` - - override forEachChild(cbNode: (node: Node) => T, cbNodeArray?: (nodes: NodeArray) => T): T | undefined { - return forEachChild(this, cbNode, cbNodeArray); - } - - override getChildren(sourceFile?: SourceFileLike): readonly Node[] { - Debug.assertValidTextRange(this, "Node without a real position cannot be scanned and thus has no token nodes - use forEachChild and collect the result if that's fine"); - return getNodeChildren(this) ?? setNodeChildren(this, createChildren(this, sourceFile)); - } - - override getFirstToken(sourceFile?: SourceFileLike): Node | undefined { - Debug.assertValidTextRange(this); - const children = this.getChildren(sourceFile); - if (!children.length) { - return undefined; - } - - const child = find(children, child => child.kind < SyntaxKind.FirstJSDocNode || child.kind > SyntaxKind.LastJSDocNode); - if (!child) { - return undefined; - } - - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getFirstToken(sourceFile); - } - - override getLastToken(sourceFile?: SourceFileLike): Node | undefined { - Debug.assertValidTextRange(this); - const children = this.getChildren(sourceFile); - if (!children.length) { - return undefined; - } - - const child = lastOrUndefined(children); - if (!child) { - return undefined; - } - - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getLastToken(sourceFile); - } } /** @internal */ @@ -314,9 +310,12 @@ export class NodeObject extends BaseNodeObject impleme } /** @internal */ -export class SourceFileObject extends BaseNodeObject implements SourceFile { +export class SourceFileObject extends BaseSyntaxObject implements SourceFile { declare kind: SyntaxKind.SourceFile; + // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. + override emitNode: EmitNode | undefined = undefined; + declare _declarationBrand: any; declare _localsContainerBrand: any; diff --git a/src/services/services.ts b/src/services/services.ts index 9f9340fab5341..0ec25031b2fda 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1,3 +1,4 @@ +import { SignatureObject, SymbolObject } from "../compiler/objectConstructors"; import { __String, ApplicableRefactorInfo, @@ -182,7 +183,6 @@ import { noop, normalizePath, NumericLiteral, - ObjectConstructors, ObjectLiteralElement, ObjectLiteralExpression, OperationCanceledException, @@ -287,7 +287,7 @@ function ensureSymbolExtraFields(symbol: Symbol) { return extra; } -ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (this: Symbol | TransientSymbol, checker: TypeChecker | undefined): SymbolDisplayPart[] { +SymbolObject.prototype.getDocumentationComment = function (this: Symbol | TransientSymbol, checker: TypeChecker | undefined): SymbolDisplayPart[] { const extra = ensureSymbolExtraFields(this); if (!extra.documentationComment) { extra.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs @@ -303,7 +303,7 @@ ObjectConstructors.SymbolObject.prototype.getDocumentationComment = function (th return extra.documentationComment; }; -ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { +SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { if (context) { const extra = ensureSymbolExtraFields(this); if (isGetAccessor(context)) { @@ -322,12 +322,12 @@ ObjectConstructors.SymbolObject.prototype.getContextualDocumentationComment = fu return this.getDocumentationComment(checker); }; -ObjectConstructors.SymbolObject.prototype.getJsDocTags = function (this: Symbol, checker?: TypeChecker): JSDocTagInfo[] { +SymbolObject.prototype.getJsDocTags = function (this: Symbol, checker?: TypeChecker): JSDocTagInfo[] { const extra = ensureSymbolExtraFields(this); return extra.tags ??= getJsDocTagsOfDeclarations(this.declarations, checker); }; -ObjectConstructors.SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { +SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { if (context) { const extra = ensureSymbolExtraFields(this); if (isGetAccessor(context)) { @@ -361,12 +361,12 @@ function ensureSignatureExtraFields(signature: Signature) { return extra; } -ObjectConstructors.SignatureObject.prototype.getDocumentationComment = function (this: Signature): SymbolDisplayPart[] { +SignatureObject.prototype.getDocumentationComment = function (this: Signature): SymbolDisplayPart[] { const extra = ensureSignatureExtraFields(this); return extra.documentationComment ??= getDocumentationComment(singleElementArray(this.declaration), this.checker); }; -ObjectConstructors.SignatureObject.prototype.getJsDocTags = function (this: Signature): JSDocTagInfo[] { +SignatureObject.prototype.getJsDocTags = function (this: Signature): JSDocTagInfo[] { const extra = ensureSignatureExtraFields(this); return extra.jsDocTags ??= getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker); }; From dc35984f711a9081c613ab72270977d2111095f9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 12 Apr 2024 12:44:13 -0400 Subject: [PATCH 14/24] Simplify Debug.enableDebugInfo() --- .vscode/launch.template.json | 2 - src/compiler/debug.ts | 210 ++++++++++++++++------------------- 2 files changed, 97 insertions(+), 115 deletions(-) diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json index de410368e9a37..01b8d631b50ab 100644 --- a/.vscode/launch.template.json +++ b/.vscode/launch.template.json @@ -50,7 +50,6 @@ "smartStep": true, "preLaunchTask": "npm: build:tests", "console": "integratedTerminal", - "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue" }, { // See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code @@ -58,7 +57,6 @@ "request": "attach", "name": "Attach to VS Code TS Server via Port", "processId": "${command:PickProcess}", - "customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue" } ] } diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 2aa31b9f1eb8a..baed30db15fd4 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -78,7 +78,7 @@ import { SnippetKind, SortedReadonlyArray, stableSort, - Symbol, + type Symbol, SymbolFlags, symbolName, SyntaxKind, @@ -94,10 +94,7 @@ import { zipWith, } from "./_namespaces/ts"; import { - IdentifierObject, - NodeObject, - SourceFileObject, - TokenObject, + BaseSyntaxObject, } from "./nodeConstructors"; import { SignatureObject, @@ -524,15 +521,16 @@ export namespace Debug { return formatEnum(facts, (ts as any).TypeFacts, /*isFlags*/ true); } + const debugDescriptionSymbol = Symbol.for("debug.description"); let isDebugInfoEnabled = false; let flowNodeProto: FlowNode | undefined; function attachFlowNodeDebugInfoWorker(flowNode: FlowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator + if (!(debugDescriptionSymbol in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json - __tsDebuggerDisplay: { + [debugDescriptionSymbol]: { value(this: FlowNode) { const flowHeader = this.flags & FlowFlags.Start ? "FlowStart" : this.flags & FlowFlags.BranchLabel ? "FlowBranchLabel" : @@ -586,9 +584,9 @@ export namespace Debug { let nodeArrayProto: NodeArray | undefined; function attachNodeArrayDebugInfoWorker(array: NodeArray) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator + if (!(debugDescriptionSymbol in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { - __tsDebuggerDisplay: { + [debugDescriptionSymbol]: { value(this: NodeArray, defaultValue: string) { // An `Array` with extra properties is rendered as `[A, B, prop1: 1, prop2: 2]`. Most of // these aren't immediately useful so we trim off the `prop1: ..., prop2: ...` part from the @@ -634,8 +632,7 @@ export namespace Debug { // Add additional properties in debug mode to assist with debugging. Object.defineProperties(SymbolObject.prototype, { - // for use with vscode-js-debug's new customDescriptionGenerator in launch.json - __tsDebuggerDisplay: { + [debugDescriptionSymbol]: { value(this: Symbol) { const symbolHeader = this.flags & SymbolFlags.Transient ? "TransientSymbol" : "Symbol"; @@ -651,8 +648,7 @@ export namespace Debug { }); Object.defineProperties(TypeObject.prototype, { - // for use with vscode-js-debug's new customDescriptionGenerator in launch.json - __tsDebuggerDisplay: { + [debugDescriptionSymbol]: { value(this: Type) { const typeHeader = this.flags & TypeFlags.Intrinsic ? `IntrinsicType ${(this as IntrinsicType).intrinsicName}${(this as IntrinsicType).debugIntrinsicName ? ` (${(this as IntrinsicType).debugIntrinsicName})` : ""}` : this.flags & TypeFlags.Nullable ? "NullableType" : @@ -717,106 +713,94 @@ export namespace Debug { }, }); - const nodeConstructors = [ - NodeObject, - IdentifierObject, - TokenObject, - SourceFileObject, - ]; - - for (const ctor of nodeConstructors) { - if (!hasProperty(ctor.prototype, "__debugKind")) { - Object.defineProperties(ctor.prototype, { - // for use with vscode-js-debug's new customDescriptionGenerator in launch.json - __tsDebuggerDisplay: { - value(this: Node) { - const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : - isIdentifier(this) ? `Identifier '${idText(this)}'` : - isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : - isStringLiteral(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : - isNumericLiteral(this) ? `NumericLiteral ${this.text}` : - isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : - isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : - isParameter(this) ? "ParameterDeclaration" : - isConstructorDeclaration(this) ? "ConstructorDeclaration" : - isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : - isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : - isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : - isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : - isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : - isTypePredicateNode(this) ? "TypePredicateNode" : - isTypeReferenceNode(this) ? "TypeReferenceNode" : - isFunctionTypeNode(this) ? "FunctionTypeNode" : - isConstructorTypeNode(this) ? "ConstructorTypeNode" : - isTypeQueryNode(this) ? "TypeQueryNode" : - isTypeLiteralNode(this) ? "TypeLiteralNode" : - isArrayTypeNode(this) ? "ArrayTypeNode" : - isTupleTypeNode(this) ? "TupleTypeNode" : - isOptionalTypeNode(this) ? "OptionalTypeNode" : - isRestTypeNode(this) ? "RestTypeNode" : - isUnionTypeNode(this) ? "UnionTypeNode" : - isIntersectionTypeNode(this) ? "IntersectionTypeNode" : - isConditionalTypeNode(this) ? "ConditionalTypeNode" : - isInferTypeNode(this) ? "InferTypeNode" : - isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : - isThisTypeNode(this) ? "ThisTypeNode" : - isTypeOperatorNode(this) ? "TypeOperatorNode" : - isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : - isMappedTypeNode(this) ? "MappedTypeNode" : - isLiteralTypeNode(this) ? "LiteralTypeNode" : - isNamedTupleMember(this) ? "NamedTupleMember" : - isImportTypeNode(this) ? "ImportTypeNode" : - formatSyntaxKind(this.kind); - return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; - }, - }, - __debugKind: { - get(this: Node) { - return formatSyntaxKind(this.kind); - }, - }, - __debugNodeFlags: { - get(this: Node) { - return formatNodeFlags(this.flags); - }, - }, - __debugModifierFlags: { - get(this: Node) { - return formatModifierFlags(getEffectiveModifierFlagsNoCache(this)); - }, - }, - __debugTransformFlags: { - get(this: Node) { - return formatTransformFlags(this.transformFlags); - }, - }, - __debugIsParseTreeNode: { - get(this: Node) { - return isParseTreeNode(this); - }, - }, - __debugEmitFlags: { - get(this: Node) { - return formatEmitFlags(getEmitFlags(this)); - }, - }, - __debugGetText: { - value(this: Node, includeTrivia?: boolean) { - if (nodeIsSynthesized(this)) return ""; - // avoid recomputing - let text = weakNodeTextMap.get(this); - if (text === undefined) { - const parseNode = getParseTreeNode(this); - const sourceFile = parseNode && getSourceFileOfNode(parseNode); - text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; - weakNodeTextMap.set(this, text); - } - return text; - }, - }, - }); - } - } + Object.defineProperties(BaseSyntaxObject.prototype, { + [debugDescriptionSymbol]: { + value(this: Node) { + const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : + isIdentifier(this) ? `Identifier '${idText(this)}'` : + isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : + isStringLiteral(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : + isNumericLiteral(this) ? `NumericLiteral ${this.text}` : + isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : + isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : + isParameter(this) ? "ParameterDeclaration" : + isConstructorDeclaration(this) ? "ConstructorDeclaration" : + isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : + isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : + isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : + isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : + isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : + isTypePredicateNode(this) ? "TypePredicateNode" : + isTypeReferenceNode(this) ? "TypeReferenceNode" : + isFunctionTypeNode(this) ? "FunctionTypeNode" : + isConstructorTypeNode(this) ? "ConstructorTypeNode" : + isTypeQueryNode(this) ? "TypeQueryNode" : + isTypeLiteralNode(this) ? "TypeLiteralNode" : + isArrayTypeNode(this) ? "ArrayTypeNode" : + isTupleTypeNode(this) ? "TupleTypeNode" : + isOptionalTypeNode(this) ? "OptionalTypeNode" : + isRestTypeNode(this) ? "RestTypeNode" : + isUnionTypeNode(this) ? "UnionTypeNode" : + isIntersectionTypeNode(this) ? "IntersectionTypeNode" : + isConditionalTypeNode(this) ? "ConditionalTypeNode" : + isInferTypeNode(this) ? "InferTypeNode" : + isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : + isThisTypeNode(this) ? "ThisTypeNode" : + isTypeOperatorNode(this) ? "TypeOperatorNode" : + isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : + isMappedTypeNode(this) ? "MappedTypeNode" : + isLiteralTypeNode(this) ? "LiteralTypeNode" : + isNamedTupleMember(this) ? "NamedTupleMember" : + isImportTypeNode(this) ? "ImportTypeNode" : + formatSyntaxKind(this.kind); + return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; + }, + }, + __debugKind: { + get(this: Node) { + return formatSyntaxKind(this.kind); + }, + }, + __debugNodeFlags: { + get(this: Node) { + return formatNodeFlags(this.flags); + }, + }, + __debugModifierFlags: { + get(this: Node) { + return formatModifierFlags(getEffectiveModifierFlagsNoCache(this)); + }, + }, + __debugTransformFlags: { + get(this: Node) { + return formatTransformFlags(this.transformFlags); + }, + }, + __debugIsParseTreeNode: { + get(this: Node) { + return isParseTreeNode(this); + }, + }, + __debugEmitFlags: { + get(this: Node) { + return formatEmitFlags(getEmitFlags(this)); + }, + }, + __debugGetText: { + value(this: Node, includeTrivia?: boolean) { + if (nodeIsSynthesized(this)) return ""; + // avoid recomputing + let text = weakNodeTextMap.get(this); + if (text === undefined) { + const parseNode = getParseTreeNode(this); + const sourceFile = parseNode && getSourceFileOfNode(parseNode); + text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + weakNodeTextMap.set(this, text); + } + return text; + }, + }, + }); isDebugInfoEnabled = true; } From 4ce5648104806bdacd4cccc7c6d5a486984603cd Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 12 Apr 2024 12:48:12 -0400 Subject: [PATCH 15/24] Fix formatting --- .vscode/launch.template.json | 4 ++-- src/compiler/debug.ts | 4 +--- src/compiler/types.ts | 2 -- src/services/services.ts | 5 ++++- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.vscode/launch.template.json b/.vscode/launch.template.json index 01b8d631b50ab..9baf0233a7328 100644 --- a/.vscode/launch.template.json +++ b/.vscode/launch.template.json @@ -49,14 +49,14 @@ "sourceMaps": true, "smartStep": true, "preLaunchTask": "npm: build:tests", - "console": "integratedTerminal", + "console": "integratedTerminal" }, { // See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code "type": "node", "request": "attach", "name": "Attach to VS Code TS Server via Port", - "processId": "${command:PickProcess}", + "processId": "${command:PickProcess}" } ] } diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index baed30db15fd4..a84eed3c35442 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -93,9 +93,7 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; -import { - BaseSyntaxObject, -} from "./nodeConstructors"; +import { BaseSyntaxObject } from "./nodeConstructors"; import { SignatureObject, SymbolObject, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 6524160947632..2bf09cb214f38 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -4400,7 +4400,6 @@ export interface SourceFile extends Declaration, LocalsContainer { /** @internal */ jsDocParsingMode?: JSDocParsingMode; - /** @internal */ scriptSnapshot: IScriptSnapshot | undefined; /** @internal */ nameTable: Map<__String, number> | undefined; /** @internal */ sourceMapper?: DocumentPositionMapper; @@ -4410,7 +4409,6 @@ export interface SourceFile extends Declaration, LocalsContainer { getLineStarts(): readonly number[]; getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; - } /** diff --git a/src/services/services.ts b/src/services/services.ts index 0ec25031b2fda..f500b65c88a0e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1,4 +1,7 @@ -import { SignatureObject, SymbolObject } from "../compiler/objectConstructors"; +import { + SignatureObject, + SymbolObject, +} from "../compiler/objectConstructors"; import { __String, ApplicableRefactorInfo, From 42065d5f01e0d8594ae299f0017a682512b711c6 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 12 Apr 2024 13:07:04 -0400 Subject: [PATCH 16/24] Add notes for possible future improvements for memory overhead --- src/compiler/objectConstructors.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index fe5d9381b43e1..1efe240e29ae8 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -49,14 +49,25 @@ export class SymbolObject implements Symbol { escapedName: __String = "" as __String; declarations?: Declaration[] = undefined; valueDeclaration?: Declaration = undefined; + + // TODO: Can we remove this property? Possibly not, but most call sites use it as a key in a Map, but we could store + // the symbol itself. id = 0; + + // TODO: Can we remove this property? We could possibly just change `mergedSymbols` in checker to be a Map with this + // symbol as the key. mergeId = 0; parent?: Symbol = undefined; members?: SymbolTable = undefined; exports?: SymbolTable = undefined; exportSymbol?: Symbol = undefined; + + // TODO: Can we remove this property or turn it into a flag along with `isReplaceableByMethod`? constEnumOnlyModule: boolean | undefined = undefined; + // TODO: Does this property require all symbol flags or a subset? Could we use a different enum and combine it with + // `constEnumOnlyModule` and `isReplaceableByMethod`? isReferenced?: SymbolFlags = undefined; + // TODO: This is set by checker and not the binder. It should be moved to `SymbolLinks`. lastAssignmentPos?: number = undefined; links?: SymbolLinks = undefined; // used by TransientSymbol @@ -119,9 +130,9 @@ export class SymbolObject implements Symbol { export class TypeObject implements Type { flags: TypeFlags; checker: TypeChecker; + id = 0; // TODO: Review for polymorphism - declare id: number; declare symbol: Symbol; declare pattern?: DestructuringPattern; declare aliasSymbol?: Symbol; @@ -260,6 +271,8 @@ export class SignatureObject implements Signature { declare thisParameter?: Symbol; declare resolvedReturnType?: Type; declare resolvedTypePredicate?: TypePredicate; + // TODO: Could we combine `minArgumentCount` and `resolvedMinArgumentCount` as two int16 values? How much slower + // would getters/setters be for these? declare minArgumentCount: number; declare resolvedMinArgumentCount?: number; declare target?: Signature; From 90a5def2c88b21f95c25494b48f26fc44814554b Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 15 Apr 2024 12:15:40 -0400 Subject: [PATCH 17/24] Update baselines --- tests/baselines/reference/api/typescript.d.ts | 90 ++++++++----------- ...deprecated-ParseForTypeErrors-file.js.diff | 2 +- ...deprecated-ParseForTypeErrors-file.ts.diff | 6 +- .../deprecated-ParseForTypeInfo-file.js.diff | 2 +- .../deprecated-ParseForTypeInfo-file.ts.diff | 10 +-- .../deprecated-ParseNone-file.js.diff | 10 +-- .../deprecated-ParseNone-file.ts.diff | 10 +-- .../link-ParseForTypeErrors-file.js.diff | 2 +- .../link-ParseForTypeErrors-file.ts.diff | 2 +- .../link-ParseForTypeInfo-file.js.diff | 2 +- .../link-ParseForTypeInfo-file.ts.diff | 4 +- .../link-ParseNone-file.js.diff | 4 +- .../link-ParseNone-file.ts.diff | 4 +- .../see-ParseForTypeErrors-file.js.diff | 2 +- .../see-ParseForTypeErrors-file.ts.diff | 2 +- .../see-ParseForTypeInfo-file.js.diff | 2 +- .../see-ParseForTypeInfo-file.ts.diff | 4 +- .../see-ParseNone-file.js.diff | 4 +- .../see-ParseNone-file.ts.diff | 4 +- 19 files changed, 73 insertions(+), 93 deletions(-) diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 76aa65dceae14..0f085e728b571 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -4210,8 +4210,6 @@ declare namespace ts { readonly kind: SyntaxKind; readonly flags: NodeFlags; readonly parent: Node; - } - interface Node { getSourceFile(): SourceFile; getChildCount(sourceFile?: SourceFile): number; getChildAt(index: number, sourceFile?: SourceFile): Node; @@ -4374,8 +4372,6 @@ declare namespace ts { * Text of identifier, but if the identifier begins with two underscores, this will begin with three. */ readonly escapedText: __String; - } - interface Identifier { readonly text: string; } interface Identifier { @@ -4413,8 +4409,6 @@ declare namespace ts { interface PrivateIdentifier extends PrimaryExpression { readonly kind: SyntaxKind.PrivateIdentifier; readonly escapedText: __String; - } - interface PrivateIdentifier { readonly text: string; } interface Decorator extends Node { @@ -5807,8 +5801,6 @@ declare namespace ts { */ interface SourceFileLike { readonly text: string; - } - interface SourceFileLike { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } type ResolutionMode = ModuleKind.ESNext | ModuleKind.CommonJS | undefined; @@ -5853,8 +5845,6 @@ declare namespace ts { * CommonJS-output-format by the node module transformer and type checker, regardless of extension or context. */ impliedNodeFormat?: ResolutionMode; - } - interface SourceFile { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineEndOfPosition(pos: number): number; getLineStarts(): readonly number[]; @@ -5862,7 +5852,7 @@ declare namespace ts { update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** - * Represents an immutable snapshot of a script at a specified time.Once acquired, the + * Represents an immutable snapshot of a script at a specified time. Once acquired, the * snapshot is observably immutable. i.e. the same calls with the same parameters will return * the same values. */ @@ -6378,6 +6368,39 @@ declare namespace ts { PropertyOrAccessor = 98308, ClassMember = 106500, } + interface SymbolDisplayPart { + /** + * Text of an item describing the symbol. + */ + text: string; + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ + kind: string; + } + interface DocumentSpan { + textSpan: TextSpan; + fileName: string; + /** + * If the span represents a location that was remapped (e.g. via a .d.ts.map file), + * then the original filename and span will be specified here + */ + originalTextSpan?: TextSpan; + originalFileName?: string; + /** + * If DocumentSpan.textSpan is the span for name of the declaration, + * then this is the span for relevant declaration + */ + contextSpan?: TextSpan; + originalContextSpan?: TextSpan; + } + interface JSDocLinkDisplayPart extends SymbolDisplayPart { + target: DocumentSpan; + } + interface JSDocTagInfo { + name: string; + text?: SymbolDisplayPart[]; + } interface Symbol { flags: SymbolFlags; escapedName: __String; @@ -6386,8 +6409,6 @@ declare namespace ts { members?: SymbolTable; exports?: SymbolTable; globalExports?: SymbolTable; - } - interface Symbol { readonly name: string; getFlags(): SymbolFlags; getEscapedName(): __String; @@ -6497,8 +6518,6 @@ declare namespace ts { pattern?: DestructuringPattern; aliasSymbol?: Symbol; aliasTypeArguments?: readonly Type[]; - } - interface Type { getFlags(): TypeFlags; getSymbol(): Symbol | undefined; getProperties(): Symbol[]; @@ -6598,9 +6617,7 @@ declare namespace ts { interface TypeReference extends ObjectType { target: GenericType; node?: TypeReferenceNode | ArrayTypeNode | TupleTypeNode; - } - interface TypeReference { - typeArguments?: readonly Type[]; + readonly typeArguments?: readonly Type[]; } interface DeferredTypeReference extends TypeReference { } @@ -6698,8 +6715,6 @@ declare namespace ts { typeParameters?: readonly TypeParameter[]; parameters: readonly Symbol[]; thisParameter?: Symbol; - } - interface Signature { getDeclaration(): JSDocSignature | SignatureDeclaration; getTypeParameters(): readonly TypeParameter[] | undefined; getParameters(): readonly Symbol[]; @@ -7212,8 +7227,6 @@ declare namespace ts { fileName: string; text: string; skipTrivia?: (pos: number) => number; - } - interface SourceMapSource { getLineAndCharacterOfPosition(pos: number): LineAndCharacter; } enum EmitFlags { @@ -10342,22 +10355,6 @@ declare namespace ts { /** The position in newText the caret should point to after the insertion. */ caretOffset: number; } - interface DocumentSpan { - textSpan: TextSpan; - fileName: string; - /** - * If the span represents a location that was remapped (e.g. via a .d.ts.map file), - * then the original filename and span will be specified here - */ - originalTextSpan?: TextSpan; - originalFileName?: string; - /** - * If DocumentSpan.textSpan is the span for name of the declaration, - * then this is the span for relevant declaration - */ - contextSpan?: TextSpan; - originalContextSpan?: TextSpan; - } interface RenameLocation extends DocumentSpan { readonly prefixText?: string; readonly suffixText?: string; @@ -10511,23 +10508,6 @@ declare namespace ts { linkName = 23, linkText = 24, } - interface SymbolDisplayPart { - /** - * Text of an item describing the symbol. - */ - text: string; - /** - * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). - */ - kind: string; - } - interface JSDocLinkDisplayPart extends SymbolDisplayPart { - target: DocumentSpan; - } - interface JSDocTagInfo { - name: string; - text?: SymbolDisplayPart[]; - } interface QuickInfo { kind: ScriptElementKind; kindModifiers: string; diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff index 663c0633bf173..5677dccfb35f1 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -230,7 +230,7 @@ +@@ -229,7 +229,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff index 3ec387bbcc392..32b78ad3bc403 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -8,9 +8,8 @@ +@@ -7,9 +7,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, @@ -11,7 +11,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -39,42 +38,9 @@ +@@ -38,42 +37,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -55,7 +55,7 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -230,6 +196,6 @@ +@@ -229,6 +195,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff index f700c77c48c7f..a97fbf3ce5868 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -230,7 +230,7 @@ +@@ -229,7 +229,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff index adfdb448a17e1..2f16dad9909f7 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -8,9 +8,8 @@ +@@ -7,9 +7,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, @@ -11,7 +11,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -39,42 +38,9 @@ +@@ -38,42 +37,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -55,7 +55,7 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -106,9 +72,8 @@ +@@ -105,9 +71,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, @@ -65,7 +65,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -137,43 +102,9 @@ +@@ -136,43 +101,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -230,6 +161,6 @@ +@@ -229,6 +160,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff index bdc677387f4ac..efc520d7027e7 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -8,9 +8,8 @@ +@@ -7,9 +7,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, @@ -11,7 +11,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -39,42 +38,9 @@ +@@ -38,42 +37,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -55,7 +55,7 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -106,9 +72,8 @@ +@@ -105,9 +71,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, @@ -65,7 +65,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -137,43 +102,9 @@ +@@ -136,43 +101,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -230,7 +161,6 @@ +@@ -229,7 +160,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff index b19a65a11ebc7..02550c8a510a6 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -8,9 +8,8 @@ +@@ -7,9 +7,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, @@ -11,7 +11,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -39,42 +38,9 @@ +@@ -38,42 +37,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -55,7 +55,7 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -106,9 +72,8 @@ +@@ -105,9 +71,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, @@ -65,7 +65,7 @@ "modifierFlagsCache": 0, "name": { "kind": "Identifier", -@@ -137,43 +102,9 @@ +@@ -136,43 +101,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -230,6 +161,6 @@ +@@ -229,6 +160,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff index e85d3dac9427d..494c3aeb461ff 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -214,7 +214,7 @@ +@@ -213,7 +213,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff index d54b75b0af7d6..0af7fab532413 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -214,6 +214,6 @@ +@@ -213,6 +213,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff index 894c809d38c7e..5a045b4126e5e 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -214,7 +214,7 @@ +@@ -213,7 +213,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff index 08154919e963e..97006eaa01077 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -88,52 +88,9 @@ +@@ -87,52 +87,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -214,6 +171,6 @@ +@@ -213,6 +170,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff index 78347a23adcef..f2794586845c2 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -88,52 +88,9 @@ +@@ -87,52 +87,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -214,7 +171,6 @@ +@@ -213,7 +170,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff index 1e73fbe1152c9..c068b27668d49 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -88,52 +88,9 @@ +@@ -87,52 +87,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -214,6 +171,6 @@ +@@ -213,6 +170,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff index 8cd70cc2c15d5..0baa7c08790ad 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -295,7 +295,7 @@ +@@ -294,7 +294,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff index e02a89d1bca31..d1b5af6de2196 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -295,6 +295,6 @@ +@@ -294,6 +294,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff index 85dc2f66b7242..b68bf681217f4 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -295,7 +295,7 @@ +@@ -294,7 +294,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff index 1c1a4fddf275a..9a981be43bd63 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -38,235 +38,9 @@ +@@ -37,235 +37,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -295,6 +69,6 @@ +@@ -294,6 +68,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff index 8bc6eacc33105..86c814e76714c 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -38,235 +38,9 @@ +@@ -37,235 +37,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -295,7 +69,6 @@ +@@ -294,7 +68,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff index 1ffd8d88f2dcd..5f145a39982a3 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -38,235 +38,9 @@ +@@ -37,235 +37,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -295,6 +69,6 @@ +@@ -294,6 +68,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], From d1ae0e85c8d3ffe4464cadbae69d8f6cdfad6756 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Mon, 15 Apr 2024 17:09:16 -0400 Subject: [PATCH 18/24] Avoid mutating SymbolObject.prototype in services --- src/compiler/objectConstructors.ts | 25 +++---- src/compiler/symbolObjectInternals.ts | 27 ++++++++ src/services/services.ts | 94 ++++++++++++++------------- 3 files changed, 86 insertions(+), 60 deletions(-) create mode 100644 src/compiler/symbolObjectInternals.ts diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index 1efe240e29ae8..4e78bd788fdef 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -42,6 +42,7 @@ import { UnionOrIntersectionType, UnionType, } from "./_namespaces/ts"; +import { SymbolObjectInternals } from "./symbolObjectInternals"; /** @internal */ export class SymbolObject implements Symbol { @@ -76,14 +77,6 @@ export class SymbolObject implements Symbol { declare assignmentDeclarationMembers?: Map; declare globalExports?: SymbolTable; - // TODO: Added by services, review for migration/polymorphism: - // documentationComment?: SymbolDisplayPart[]; - // tags?: JSDocTagInfo[]; // same - // contextualGetAccessorDocumentationComment?: SymbolDisplayPart[]; - // contextualSetAccessorDocumentationComment?: SymbolDisplayPart[]; - // contextualGetAccessorTags?: JSDocTagInfo[]; - // contextualSetAccessorTags?: JSDocTagInfo[]; - constructor(flags: SymbolFlags, name: __String) { this.flags = flags; this.escapedName = name; @@ -109,20 +102,20 @@ export class SymbolObject implements Symbol { return this.declarations; } - getDocumentationComment(_checker: TypeChecker | undefined): SymbolDisplayPart[] { - throw new TypeError("Not implemented."); + getDocumentationComment(checker: TypeChecker | undefined): SymbolDisplayPart[] { + return SymbolObjectInternals.internals.getDocumentationComment(this, checker); } - getContextualDocumentationComment(_context: Node | undefined, _checker: TypeChecker | undefined): SymbolDisplayPart[] { - throw new TypeError("Not implemented."); + getContextualDocumentationComment(context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { + return SymbolObjectInternals.internals.getContextualDocumentationComment(this, context, checker); } - getJsDocTags(_checker?: TypeChecker): JSDocTagInfo[] { - throw new TypeError("Not implemented."); + getJsDocTags(checker?: TypeChecker): JSDocTagInfo[] { + return SymbolObjectInternals.internals.getJsDocTags(this, checker); } - getContextualJsDocTags(_context: Node | undefined, _checker: TypeChecker | undefined): JSDocTagInfo[] { - throw new TypeError("Not implemented."); + getContextualJsDocTags(context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { + return SymbolObjectInternals.internals.getContextualJsDocTags(this, context, checker); } } diff --git a/src/compiler/symbolObjectInternals.ts b/src/compiler/symbolObjectInternals.ts new file mode 100644 index 0000000000000..90022d68977e0 --- /dev/null +++ b/src/compiler/symbolObjectInternals.ts @@ -0,0 +1,27 @@ +import { SymbolObject } from "./objectConstructors"; +import { JSDocTagInfo, Node, SymbolDisplayPart, TypeChecker } from "./types"; + +/** @internal */ +export class SymbolObjectInternals { + static internals = new SymbolObjectInternals(); + + getDocumentationComment(symbol: SymbolObject, typeChecker: TypeChecker | undefined): SymbolDisplayPart[]; + getDocumentationComment(_symbol: SymbolObject, _typeChecker: TypeChecker | undefined): SymbolDisplayPart[] { + throw new TypeError("Not implemented."); + } + + getContextualDocumentationComment(symbol: SymbolObject, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[]; + getContextualDocumentationComment(_symbol: SymbolObject, _context: Node | undefined, _checker: TypeChecker | undefined): SymbolDisplayPart[] { + throw new TypeError("Not implemented."); + } + + getJsDocTags(symbol: SymbolObject, checker?: TypeChecker): JSDocTagInfo[]; + getJsDocTags(_symbol: SymbolObject, _checker?: TypeChecker): JSDocTagInfo[] { + throw new TypeError("Not implemented."); + } + + getContextualJsDocTags(symbol: SymbolObject, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[]; + getContextualJsDocTags(_symbol: SymbolObject, _context: Node | undefined, _checker: TypeChecker | undefined): JSDocTagInfo[] { + throw new TypeError("Not implemented."); + } +} diff --git a/src/services/services.ts b/src/services/services.ts index f500b65c88a0e..c1207c1e3fc4d 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,6 +2,7 @@ import { SignatureObject, SymbolObject, } from "../compiler/objectConstructors"; +import { SymbolObjectInternals } from "../compiler/symbolObjectInternals"; import { __String, ApplicableRefactorInfo, @@ -290,64 +291,69 @@ function ensureSymbolExtraFields(symbol: Symbol) { return extra; } -SymbolObject.prototype.getDocumentationComment = function (this: Symbol | TransientSymbol, checker: TypeChecker | undefined): SymbolDisplayPart[] { - const extra = ensureSymbolExtraFields(this); - if (!extra.documentationComment) { - extra.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs +class ServicesSymbolObjectInternals extends SymbolObjectInternals { + override getDocumentationComment(symbol: SymbolObject, checker: TypeChecker | undefined): SymbolDisplayPart[] { + const extra = ensureSymbolExtraFields(symbol); + if (!extra.documentationComment) { + extra.documentationComment = emptyArray; // Set temporarily to avoid an infinite loop finding inherited docs - if (!this.declarations && isTransientSymbol(this) && this.links.target && isTransientSymbol(this.links.target) && this.links.target.links.tupleLabelDeclaration) { - const labelDecl = this.links.target.links.tupleLabelDeclaration; - extra.documentationComment = getDocumentationComment([labelDecl], checker); - } - else { - extra.documentationComment = getDocumentationComment(this.declarations, checker); + if (!symbol.declarations && isTransientSymbol(symbol) && symbol.links.target && isTransientSymbol(symbol.links.target) && symbol.links.target.links.tupleLabelDeclaration) { + const labelDecl = symbol.links.target.links.tupleLabelDeclaration; + extra.documentationComment = getDocumentationComment([labelDecl], checker); + } + else { + extra.documentationComment = getDocumentationComment(symbol.declarations, checker); + } } + return extra.documentationComment; } - return extra.documentationComment; -}; -SymbolObject.prototype.getContextualDocumentationComment = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { - if (context) { - const extra = ensureSymbolExtraFields(this); - if (isGetAccessor(context)) { - extra.contextualGetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isGetAccessor), checker); - if (length(extra.contextualGetAccessorDocumentationComment)) { - return extra.contextualGetAccessorDocumentationComment; + override getContextualDocumentationComment(symbol: SymbolObject, context: Node | undefined, checker: TypeChecker | undefined): SymbolDisplayPart[] { + if (context) { + const extra = ensureSymbolExtraFields(symbol); + if (isGetAccessor(context)) { + extra.contextualGetAccessorDocumentationComment ??= getDocumentationComment(filter(symbol.declarations, isGetAccessor), checker); + if (length(extra.contextualGetAccessorDocumentationComment)) { + return extra.contextualGetAccessorDocumentationComment; + } } - } - else if (isSetAccessor(context)) { - extra.contextualSetAccessorDocumentationComment ??= getDocumentationComment(filter(this.declarations, isSetAccessor), checker); - if (length(extra.contextualSetAccessorDocumentationComment)) { - return extra.contextualSetAccessorDocumentationComment; + else if (isSetAccessor(context)) { + extra.contextualSetAccessorDocumentationComment ??= getDocumentationComment(filter(symbol.declarations, isSetAccessor), checker); + if (length(extra.contextualSetAccessorDocumentationComment)) { + return extra.contextualSetAccessorDocumentationComment; + } } } + return this.getDocumentationComment(symbol, checker); } - return this.getDocumentationComment(checker); -}; -SymbolObject.prototype.getJsDocTags = function (this: Symbol, checker?: TypeChecker): JSDocTagInfo[] { - const extra = ensureSymbolExtraFields(this); - return extra.tags ??= getJsDocTagsOfDeclarations(this.declarations, checker); -}; + override getJsDocTags(symbol: SymbolObject, checker?: TypeChecker): JSDocTagInfo[] { + const extra = ensureSymbolExtraFields(symbol); + return extra.tags ??= getJsDocTagsOfDeclarations(symbol.declarations, checker); + } -SymbolObject.prototype.getContextualJsDocTags = function (this: Symbol, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { - if (context) { - const extra = ensureSymbolExtraFields(this); - if (isGetAccessor(context)) { - extra.contextualGetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isGetAccessor), checker); - if (length(extra.contextualGetAccessorTags)) { - return extra.contextualGetAccessorTags; + override getContextualJsDocTags(symbol: SymbolObject, context: Node | undefined, checker: TypeChecker | undefined): JSDocTagInfo[] { + if (context) { + const extra = ensureSymbolExtraFields(symbol); + if (isGetAccessor(context)) { + extra.contextualGetAccessorTags ??= getJsDocTagsOfDeclarations(filter(symbol.declarations, isGetAccessor), checker); + if (length(extra.contextualGetAccessorTags)) { + return extra.contextualGetAccessorTags; + } } - } - else if (isSetAccessor(context)) { - extra.contextualSetAccessorTags ??= getJsDocTagsOfDeclarations(filter(this.declarations, isSetAccessor), checker); - if (length(extra.contextualSetAccessorTags)) { - return extra.contextualSetAccessorTags; + else if (isSetAccessor(context)) { + extra.contextualSetAccessorTags ??= getJsDocTagsOfDeclarations(filter(symbol.declarations, isSetAccessor), checker); + if (length(extra.contextualSetAccessorTags)) { + return extra.contextualSetAccessorTags; + } } } + return this.getJsDocTags(symbol, checker); } - return this.getJsDocTags(checker); -}; +} + +// Override the internals for symbols +SymbolObjectInternals.internals = new ServicesSymbolObjectInternals(); interface SignatureExtraFields { // Undefined is used to indicate the value has not been computed. If, after computing, the From c0ce5853f9f5d4f9ec61aa2685eac2108a2f655f Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 16 Apr 2024 18:16:48 -0400 Subject: [PATCH 19/24] Shallow constructors for NodeObject et al. --- .gitignore | 2 + src/compiler/debug.ts | 4 +- src/compiler/nodeConstructors.ts | 198 ++++++++++++++++++++++--------- 3 files changed, 147 insertions(+), 57 deletions(-) diff --git a/.gitignore b/.gitignore index 54604cdbd35a3..d2cfe64b56bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -63,4 +63,6 @@ TEST-results.xml package-lock.json .eslintcache *v8.log +*.heapsnapshot +*.heapprofile /lib/ diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index a84eed3c35442..82c57465d4816 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -93,7 +93,7 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; -import { BaseSyntaxObject } from "./nodeConstructors"; +import { BaseNodeObject } from "./nodeConstructors"; import { SignatureObject, SymbolObject, @@ -711,7 +711,7 @@ export namespace Debug { }, }); - Object.defineProperties(BaseSyntaxObject.prototype, { + Object.defineProperties(BaseNodeObject.prototype, { [debugDescriptionSymbol]: { value(this: Node) { const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 0ad254df8654a..6afa89a3c9b21 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -89,23 +89,18 @@ import { } from "./_namespaces/ts"; /** @internal */ -export abstract class BaseSyntaxObject implements Node { - kind = SyntaxKind.Unknown; - pos = -1; - end = -1; - id = 0; - flags: NodeFlags = NodeFlags.None; - transformFlags: TransformFlags = TransformFlags.None; - parent: Node = undefined!; - original: Node | undefined = undefined; - - abstract modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` +export abstract class BaseNodeObject implements Node { + abstract pos: number; + abstract end: number; + abstract kind: SyntaxKind; + abstract id: number; + abstract flags: NodeFlags; + abstract transformFlags: TransformFlags; + abstract parent: Node; + abstract original: Node | undefined; + abstract modifierFlagsCache: ModifierFlags; abstract emitNode: EmitNode | undefined; - constructor(kind: SyntaxKind) { - this.kind = kind; - } - getSourceFile(): SourceFile { return getSourceFileOfNode(this); } @@ -180,7 +175,7 @@ export abstract class BaseSyntaxObject implements Node { return undefined; } - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getFirstToken(sourceFile); + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseNodeObject).getFirstToken(sourceFile); } getLastToken(sourceFile?: SourceFileLike): Node | undefined { @@ -195,12 +190,12 @@ export abstract class BaseSyntaxObject implements Node { return undefined; } - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseSyntaxObject).getLastToken(sourceFile); + return child.kind < SyntaxKind.FirstNode ? child : (child as BaseNodeObject).getLastToken(sourceFile); } } /** @internal */ -export abstract class BaseTokenObject extends BaseSyntaxObject { +export abstract class BaseTokenObject extends BaseNodeObject { // NOTE: Tokens generally do not have or need emitNode entries, so they are declared but not defined to reduce // memory footprint. declare emitNode: EmitNode | undefined; @@ -228,18 +223,34 @@ export abstract class BaseTokenObject extends BaseSyntaxObject { } /** @internal */ -export class TokenObject extends BaseTokenObject implements Token { - declare kind: TKind; - +export class TokenObject implements Token { + pos: number; + end: number; + kind: TKind; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; constructor(kind: TKind) { - super(kind); + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; } } /** @internal */ -export class IdentifierObject extends BaseTokenObject implements Identifier { - declare kind: SyntaxKind.Identifier; +export interface TokenObject extends BaseTokenObject {} +Object.setPrototypeOf(TokenObject.prototype, BaseTokenObject.prototype); +/** @internal */ +export class IdentifierObject implements Identifier { + // #region Brands declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; declare _leftHandSideExpressionBrand: any; @@ -249,17 +260,37 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { declare _declarationBrand: any; declare _jsdocContainerBrand: any; declare _flowContainerBrand: any; - + // #endregion Brands + + pos: number; + end: number; + kind: SyntaxKind.Identifier; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; // NOTE: Though tokens, Identifiers often need emitNode - override emitNode: EmitNode | undefined = undefined; - - escapedText: __String = "" as __String; - symbol: Symbol = undefined!; // initialized by checker - jsDoc?: JSDoc[] = undefined; // initialized by parser (JsDocContainer) - flowNode?: FlowNode = undefined; // initialized by binder (FlowContainer) + emitNode: EmitNode | undefined; + escapedText: __String; + symbol: Symbol; // initialized by checker + jsDoc?: JSDoc[]; // initialized by parser (JsDocContainer) + flowNode?: FlowNode; // initialized by binder (FlowContainer) constructor() { - super(SyntaxKind.Identifier); + this.pos = -1; + this.end = -1; + this.kind = SyntaxKind.Identifier; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.escapedText = "" as __String; + this.symbol = undefined!; + this.jsDoc = undefined; + this.flowNode = undefined; } get text(): string { @@ -268,23 +299,43 @@ export class IdentifierObject extends BaseTokenObject implements Identifier { } /** @internal */ -export class PrivateIdentifierObject extends BaseTokenObject implements PrivateIdentifier { - declare kind: SyntaxKind.PrivateIdentifier; +export interface IdentifierObject extends BaseTokenObject {} +Object.setPrototypeOf(IdentifierObject.prototype, BaseTokenObject.prototype); +/** @internal */ +export class PrivateIdentifierObject implements PrivateIdentifier { + // #region Brands declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; declare _leftHandSideExpressionBrand: any; declare _updateExpressionBrand: any; declare _unaryExpressionBrand: any; declare _expressionBrand: any; - + // #endregion Brands + + pos: number; + end: number; + kind: SyntaxKind.PrivateIdentifier; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; // NOTE: Though tokens, PrivateIdentifiers often need emitNode - override emitNode: EmitNode | undefined = undefined; - - escapedText: __String = "" as __String; + emitNode: EmitNode | undefined = undefined; + escapedText: __String; constructor() { - super(SyntaxKind.PrivateIdentifier); + this.pos = -1; + this.end = -1; + this.kind = SyntaxKind.PrivateIdentifier; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.escapedText = "" as __String; } get text(): string { @@ -293,28 +344,55 @@ export class PrivateIdentifierObject extends BaseTokenObject implements PrivateI } /** @internal */ -export abstract class BaseNodeObject extends BaseSyntaxObject { - // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. - override emitNode: EmitNode | undefined = undefined; - // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism - override modifierFlagsCache: ModifierFlags = ModifierFlags.None; // TODO: move this off `Node` -} +export interface PrivateIdentifierObject extends BaseTokenObject {} +Object.setPrototypeOf(PrivateIdentifierObject.prototype, BaseTokenObject.prototype); /** @internal */ -export class NodeObject extends BaseNodeObject implements Node { - declare kind: TKind; +export class NodeObject implements Node { + pos: number; + end: number; + kind: SyntaxKind; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; + // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. + emitNode: EmitNode | undefined; + // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism + modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` - constructor(kind: TKind) { - super(kind); + constructor(kind: SyntaxKind) { + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + this.modifierFlagsCache = ModifierFlags.None; } } /** @internal */ -export class SourceFileObject extends BaseSyntaxObject implements SourceFile { - declare kind: SyntaxKind.SourceFile; +export interface NodeObject extends BaseNodeObject {} +Object.setPrototypeOf(NodeObject.prototype, BaseNodeObject.prototype); +/** @internal */ +export class SourceFileObject implements SourceFile { + pos: number; + end: number; + kind: SyntaxKind.SourceFile; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. - override emitNode: EmitNode | undefined = undefined; + emitNode: EmitNode | undefined; + declare modifierFlagsCache: ModifierFlags; declare _declarationBrand: any; declare _localsContainerBrand: any; @@ -373,8 +451,6 @@ export class SourceFileObject extends BaseSyntaxObject implements SourceFile { declare endFlowNode?: FlowNode; declare symbol: Symbol; declare localSymbol?: Symbol; - declare modifierFlagsCache: ModifierFlags; - declare transformFlags: TransformFlags; declare locals?: SymbolTable; declare nextContainer?: HasLocals; declare scriptSnapshot: IScriptSnapshot; @@ -383,7 +459,15 @@ export class SourceFileObject extends BaseSyntaxObject implements SourceFile { declare private namedDeclarations: Map | undefined; constructor() { - super(SyntaxKind.SourceFile); + this.pos = -1; + this.end = -1; + this.kind = SyntaxKind.SourceFile; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; } public update(newText: string, textChangeRange: TextChangeRange): SourceFile { @@ -576,6 +660,10 @@ export class SourceFileObject extends BaseSyntaxObject implements SourceFile { } } +/** @internal */ +export interface SourceFileObject extends BaseNodeObject {} +Object.setPrototypeOf(SourceFileObject.prototype, BaseNodeObject.prototype); + let scanner: Scanner | undefined; function createChildren(node: Node, sourceFile: SourceFileLike | undefined): readonly Node[] { From 1b39a6dd6698cd2cd2f9c6128038fa3692098949 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 17 Apr 2024 18:29:57 -0400 Subject: [PATCH 20/24] Remove unnecessary import alias for SymbolObject --- src/compiler/binder.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 38451367bb6d2..a0c018d561541 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -321,7 +321,7 @@ import { WithStatement, } from "./_namespaces/ts"; import * as performance from "./_namespaces/ts.performance"; -import { SymbolObject as SymbolObject } from "./objectConstructors"; +import { SymbolObject } from "./objectConstructors"; /** @internal */ export const enum ModuleInstanceState { From cf125da164c9e854120df87d4d319a35a1751288 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 17 Apr 2024 19:31:34 -0400 Subject: [PATCH 21/24] Update classes to more closely align with recent changes to services --- src/compiler/debug.ts | 164 +++++++++---------- src/compiler/nodeConstructors.ts | 268 ++++++++++++++----------------- 2 files changed, 202 insertions(+), 230 deletions(-) diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 82c57465d4816..1710c5ed1fb96 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -93,7 +93,7 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; -import { BaseNodeObject } from "./nodeConstructors"; +import { NodeObject, TokenOrIdentifierObject } from "./nodeConstructors"; import { SignatureObject, SymbolObject, @@ -711,94 +711,96 @@ export namespace Debug { }, }); - Object.defineProperties(BaseNodeObject.prototype, { - [debugDescriptionSymbol]: { - value(this: Node) { - const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : - isIdentifier(this) ? `Identifier '${idText(this)}'` : - isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : - isStringLiteral(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : - isNumericLiteral(this) ? `NumericLiteral ${this.text}` : - isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : - isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : - isParameter(this) ? "ParameterDeclaration" : - isConstructorDeclaration(this) ? "ConstructorDeclaration" : - isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : - isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : - isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : - isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : - isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : - isTypePredicateNode(this) ? "TypePredicateNode" : - isTypeReferenceNode(this) ? "TypeReferenceNode" : - isFunctionTypeNode(this) ? "FunctionTypeNode" : - isConstructorTypeNode(this) ? "ConstructorTypeNode" : - isTypeQueryNode(this) ? "TypeQueryNode" : - isTypeLiteralNode(this) ? "TypeLiteralNode" : - isArrayTypeNode(this) ? "ArrayTypeNode" : - isTupleTypeNode(this) ? "TupleTypeNode" : - isOptionalTypeNode(this) ? "OptionalTypeNode" : - isRestTypeNode(this) ? "RestTypeNode" : - isUnionTypeNode(this) ? "UnionTypeNode" : - isIntersectionTypeNode(this) ? "IntersectionTypeNode" : - isConditionalTypeNode(this) ? "ConditionalTypeNode" : - isInferTypeNode(this) ? "InferTypeNode" : - isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : - isThisTypeNode(this) ? "ThisTypeNode" : - isTypeOperatorNode(this) ? "TypeOperatorNode" : - isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : - isMappedTypeNode(this) ? "MappedTypeNode" : - isLiteralTypeNode(this) ? "LiteralTypeNode" : - isNamedTupleMember(this) ? "NamedTupleMember" : - isImportTypeNode(this) ? "ImportTypeNode" : - formatSyntaxKind(this.kind); - return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; + for (const prototype of [NodeObject.prototype, TokenOrIdentifierObject.prototype]) { + Object.defineProperties(prototype, { + [debugDescriptionSymbol]: { + value(this: Node) { + const nodeHeader = isGeneratedIdentifier(this) ? "GeneratedIdentifier" : + isIdentifier(this) ? `Identifier '${idText(this)}'` : + isPrivateIdentifier(this) ? `PrivateIdentifier '${idText(this)}'` : + isStringLiteral(this) ? `StringLiteral ${JSON.stringify(this.text.length < 10 ? this.text : this.text.slice(10) + "...")}` : + isNumericLiteral(this) ? `NumericLiteral ${this.text}` : + isBigIntLiteral(this) ? `BigIntLiteral ${this.text}n` : + isTypeParameterDeclaration(this) ? "TypeParameterDeclaration" : + isParameter(this) ? "ParameterDeclaration" : + isConstructorDeclaration(this) ? "ConstructorDeclaration" : + isGetAccessorDeclaration(this) ? "GetAccessorDeclaration" : + isSetAccessorDeclaration(this) ? "SetAccessorDeclaration" : + isCallSignatureDeclaration(this) ? "CallSignatureDeclaration" : + isConstructSignatureDeclaration(this) ? "ConstructSignatureDeclaration" : + isIndexSignatureDeclaration(this) ? "IndexSignatureDeclaration" : + isTypePredicateNode(this) ? "TypePredicateNode" : + isTypeReferenceNode(this) ? "TypeReferenceNode" : + isFunctionTypeNode(this) ? "FunctionTypeNode" : + isConstructorTypeNode(this) ? "ConstructorTypeNode" : + isTypeQueryNode(this) ? "TypeQueryNode" : + isTypeLiteralNode(this) ? "TypeLiteralNode" : + isArrayTypeNode(this) ? "ArrayTypeNode" : + isTupleTypeNode(this) ? "TupleTypeNode" : + isOptionalTypeNode(this) ? "OptionalTypeNode" : + isRestTypeNode(this) ? "RestTypeNode" : + isUnionTypeNode(this) ? "UnionTypeNode" : + isIntersectionTypeNode(this) ? "IntersectionTypeNode" : + isConditionalTypeNode(this) ? "ConditionalTypeNode" : + isInferTypeNode(this) ? "InferTypeNode" : + isParenthesizedTypeNode(this) ? "ParenthesizedTypeNode" : + isThisTypeNode(this) ? "ThisTypeNode" : + isTypeOperatorNode(this) ? "TypeOperatorNode" : + isIndexedAccessTypeNode(this) ? "IndexedAccessTypeNode" : + isMappedTypeNode(this) ? "MappedTypeNode" : + isLiteralTypeNode(this) ? "LiteralTypeNode" : + isNamedTupleMember(this) ? "NamedTupleMember" : + isImportTypeNode(this) ? "ImportTypeNode" : + formatSyntaxKind(this.kind); + return `${nodeHeader}${this.flags ? ` (${formatNodeFlags(this.flags)})` : ""}`; + }, }, - }, - __debugKind: { - get(this: Node) { - return formatSyntaxKind(this.kind); + __debugKind: { + get(this: Node) { + return formatSyntaxKind(this.kind); + }, }, - }, - __debugNodeFlags: { - get(this: Node) { - return formatNodeFlags(this.flags); + __debugNodeFlags: { + get(this: Node) { + return formatNodeFlags(this.flags); + }, }, - }, - __debugModifierFlags: { - get(this: Node) { - return formatModifierFlags(getEffectiveModifierFlagsNoCache(this)); + __debugModifierFlags: { + get(this: Node) { + return formatModifierFlags(getEffectiveModifierFlagsNoCache(this)); + }, }, - }, - __debugTransformFlags: { - get(this: Node) { - return formatTransformFlags(this.transformFlags); + __debugTransformFlags: { + get(this: Node) { + return formatTransformFlags(this.transformFlags); + }, }, - }, - __debugIsParseTreeNode: { - get(this: Node) { - return isParseTreeNode(this); + __debugIsParseTreeNode: { + get(this: Node) { + return isParseTreeNode(this); + }, }, - }, - __debugEmitFlags: { - get(this: Node) { - return formatEmitFlags(getEmitFlags(this)); + __debugEmitFlags: { + get(this: Node) { + return formatEmitFlags(getEmitFlags(this)); + }, }, - }, - __debugGetText: { - value(this: Node, includeTrivia?: boolean) { - if (nodeIsSynthesized(this)) return ""; - // avoid recomputing - let text = weakNodeTextMap.get(this); - if (text === undefined) { - const parseNode = getParseTreeNode(this); - const sourceFile = parseNode && getSourceFileOfNode(parseNode); - text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; - weakNodeTextMap.set(this, text); - } - return text; + __debugGetText: { + value(this: Node, includeTrivia?: boolean) { + if (nodeIsSynthesized(this)) return ""; + // avoid recomputing + let text = weakNodeTextMap.get(this); + if (text === undefined) { + const parseNode = getParseTreeNode(this); + const sourceFile = parseNode && getSourceFileOfNode(parseNode); + text = sourceFile ? getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : ""; + weakNodeTextMap.set(this, text); + } + return text; + }, }, - }, - }); + }); + } isDebugInfoEnabled = true; } diff --git a/src/compiler/nodeConstructors.ts b/src/compiler/nodeConstructors.ts index 6afa89a3c9b21..28dde59d74a91 100644 --- a/src/compiler/nodeConstructors.ts +++ b/src/compiler/nodeConstructors.ts @@ -89,17 +89,32 @@ import { } from "./_namespaces/ts"; /** @internal */ -export abstract class BaseNodeObject implements Node { - abstract pos: number; - abstract end: number; - abstract kind: SyntaxKind; - abstract id: number; - abstract flags: NodeFlags; - abstract transformFlags: TransformFlags; - abstract parent: Node; - abstract original: Node | undefined; - abstract modifierFlagsCache: ModifierFlags; - abstract emitNode: EmitNode | undefined; +export class NodeObject implements Node { + pos: number; + end: number; + kind: SyntaxKind; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; + // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. + emitNode: EmitNode | undefined; + // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism + modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` + + constructor(kind: SyntaxKind) { + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.modifierFlagsCache = ModifierFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } getSourceFile(): SourceFile { return getSourceFileOfNode(this); @@ -175,7 +190,7 @@ export abstract class BaseNodeObject implements Node { return undefined; } - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseNodeObject).getFirstToken(sourceFile); + return child.kind < SyntaxKind.FirstNode ? child : child.getFirstToken(sourceFile); } getLastToken(sourceFile?: SourceFileLike): Node | undefined { @@ -190,66 +205,118 @@ export abstract class BaseNodeObject implements Node { return undefined; } - return child.kind < SyntaxKind.FirstNode ? child : (child as BaseNodeObject).getLastToken(sourceFile); + return child.kind < SyntaxKind.FirstNode ? child : child.getLastToken(sourceFile); } } /** @internal */ -export abstract class BaseTokenObject extends BaseNodeObject { - // NOTE: Tokens generally do not have or need emitNode entries, so they are declared but not defined to reduce - // memory footprint. - declare emitNode: EmitNode | undefined; +export abstract class TokenOrIdentifierObject implements Node { + pos: number; + end: number; + kind: TKind; + id: number; + flags: NodeFlags; + transformFlags: TransformFlags; + parent: Node; + original: Node | undefined; + emitNode: EmitNode | undefined; // NOTE: Tokens cannot have modifiers, so they are declared but not defined to reduce memory footprint declare modifierFlagsCache: ModifierFlags; - override forEachChild(_cbNode: (node: Node) => T, _cbNodeArray?: (nodes: NodeArray) => T): T | undefined { + constructor(kind: TKind) { + this.pos = -1; + this.end = -1; + this.kind = kind; + this.id = 0; + this.flags = NodeFlags.None; + this.transformFlags = TransformFlags.None; + this.parent = undefined!; + this.original = undefined; + this.emitNode = undefined; + } + + getSourceFile(): SourceFile { + return getSourceFileOfNode(this); + } + + getStart(sourceFile?: SourceFileLike, includeJsDocComment?: boolean): number { + Debug.assertValidTextRange(this); + return getTokenPosOfNode(this, sourceFile, includeJsDocComment); + } + + getFullStart(): number { + Debug.assertValidTextRange(this); + return this.pos; + } + + getEnd(): number { + Debug.assertValidTextRange(this); + return this.end; + } + + getWidth(sourceFile?: SourceFile): number { + Debug.assertValidTextRange(this); + return this.getEnd() - this.getStart(sourceFile); + } + + getFullWidth(): number { + Debug.assertValidTextRange(this); + return this.end - this.pos; + } + + getLeadingTriviaWidth(sourceFile?: SourceFile): number { + return this.getStart(sourceFile) - this.pos; + } + + getFullText(sourceFile?: SourceFile): string { + Debug.assertValidTextRange(this); + sourceFile ??= this.getSourceFile(); + return sourceFile.text.substring(this.pos, this.end); + } + + getText(sourceFile?: SourceFile): string { + Debug.assertValidTextRange(this); + sourceFile ??= this.getSourceFile(); + return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd()); + } + + getChildCount(sourceFile?: SourceFile): number { + return this.getChildren(sourceFile).length; + } + + getChildAt(index: number, sourceFile?: SourceFile): Node { + return this.getChildren(sourceFile)[index]; + } + + forEachChild(_cbNode: (node: Node) => T, _cbNodeArray?: (nodes: NodeArray) => T): T | undefined { // Tokens cannot have source element children return undefined; } - override getChildren(_sourceFile?: SourceFileLike): readonly Node[] { + getChildren(_sourceFile?: SourceFileLike): readonly Node[] { return this.kind === SyntaxKind.EndOfFileToken ? (this as Node as EndOfFileToken).jsDoc ?? emptyArray : emptyArray; } - override getFirstToken(_sourceFile?: SourceFileLike): Node | undefined { + getFirstToken(_sourceFile?: SourceFileLike): Node | undefined { // Tokens cannot have source element children return undefined!; } - override getLastToken(_sourceFile?: SourceFileLike): Node | undefined { + getLastToken(_sourceFile?: SourceFileLike): Node | undefined { // Tokens cannot have source element children return undefined!; } } /** @internal */ -export class TokenObject implements Token { - pos: number; - end: number; - kind: TKind; - id: number; - flags: NodeFlags; - transformFlags: TransformFlags; - parent: Node; - original: Node | undefined; +export class TokenObject extends TokenOrIdentifierObject implements Token { constructor(kind: TKind) { - this.pos = -1; - this.end = -1; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; + super(kind); } } /** @internal */ -export interface TokenObject extends BaseTokenObject {} -Object.setPrototypeOf(TokenObject.prototype, BaseTokenObject.prototype); - -/** @internal */ -export class IdentifierObject implements Identifier { +export class IdentifierObject extends TokenOrIdentifierObject implements Identifier { // #region Brands declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; @@ -262,31 +329,13 @@ export class IdentifierObject implements Identifier { declare _flowContainerBrand: any; // #endregion Brands - pos: number; - end: number; - kind: SyntaxKind.Identifier; - id: number; - flags: NodeFlags; - transformFlags: TransformFlags; - parent: Node; - original: Node | undefined; - // NOTE: Though tokens, Identifiers often need emitNode - emitNode: EmitNode | undefined; escapedText: __String; symbol: Symbol; // initialized by checker jsDoc?: JSDoc[]; // initialized by parser (JsDocContainer) flowNode?: FlowNode; // initialized by binder (FlowContainer) constructor() { - this.pos = -1; - this.end = -1; - this.kind = SyntaxKind.Identifier; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; + super(SyntaxKind.Identifier); this.escapedText = "" as __String; this.symbol = undefined!; this.jsDoc = undefined; @@ -299,11 +348,7 @@ export class IdentifierObject implements Identifier { } /** @internal */ -export interface IdentifierObject extends BaseTokenObject {} -Object.setPrototypeOf(IdentifierObject.prototype, BaseTokenObject.prototype); - -/** @internal */ -export class PrivateIdentifierObject implements PrivateIdentifier { +export class PrivateIdentifierObject extends TokenOrIdentifierObject implements PrivateIdentifier { // #region Brands declare _primaryExpressionBrand: any; declare _memberExpressionBrand: any; @@ -313,28 +358,10 @@ export class PrivateIdentifierObject implements PrivateIdentifier { declare _expressionBrand: any; // #endregion Brands - pos: number; - end: number; - kind: SyntaxKind.PrivateIdentifier; - id: number; - flags: NodeFlags; - transformFlags: TransformFlags; - parent: Node; - original: Node | undefined; - // NOTE: Though tokens, PrivateIdentifiers often need emitNode - emitNode: EmitNode | undefined = undefined; escapedText: __String; constructor() { - this.pos = -1; - this.end = -1; - this.kind = SyntaxKind.PrivateIdentifier; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; + super(SyntaxKind.PrivateIdentifier); this.escapedText = "" as __String; } @@ -344,59 +371,14 @@ export class PrivateIdentifierObject implements PrivateIdentifier { } /** @internal */ -export interface PrivateIdentifierObject extends BaseTokenObject {} -Object.setPrototypeOf(PrivateIdentifierObject.prototype, BaseTokenObject.prototype); - -/** @internal */ -export class NodeObject implements Node { - pos: number; - end: number; - kind: SyntaxKind; - id: number; - flags: NodeFlags; - transformFlags: TransformFlags; - parent: Node; - original: Node | undefined; - // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. - emitNode: EmitNode | undefined; - // NOTE: Non-token nodes may have modifiers, so they are defined to reduce polymorphism - modifierFlagsCache: ModifierFlags; // TODO: move this off `Node` - - constructor(kind: SyntaxKind) { - this.pos = -1; - this.end = -1; - this.kind = kind; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; - this.modifierFlagsCache = ModifierFlags.None; - } -} - -/** @internal */ -export interface NodeObject extends BaseNodeObject {} -Object.setPrototypeOf(NodeObject.prototype, BaseNodeObject.prototype); - -/** @internal */ -export class SourceFileObject implements SourceFile { - pos: number; - end: number; - kind: SyntaxKind.SourceFile; - id: number; - flags: NodeFlags; - transformFlags: TransformFlags; - parent: Node; - original: Node | undefined; - // NOTE: Non-token nodes often need emitNode entries, so they are defined to reduce polymorphism. - emitNode: EmitNode | undefined; - declare modifierFlagsCache: ModifierFlags; - +export class SourceFileObject extends NodeObject implements SourceFile { + // #region Brands declare _declarationBrand: any; declare _localsContainerBrand: any; + // #endregion Brands + declare kind: SyntaxKind.SourceFile; + declare modifierFlagsCache: ModifierFlags; declare statements: NodeArray; declare endOfFileToken: Token; declare fileName: string; @@ -459,15 +441,7 @@ export class SourceFileObject implements SourceFile { declare private namedDeclarations: Map | undefined; constructor() { - this.pos = -1; - this.end = -1; - this.kind = SyntaxKind.SourceFile; - this.id = 0; - this.flags = NodeFlags.None; - this.transformFlags = TransformFlags.None; - this.parent = undefined!; - this.original = undefined; - this.emitNode = undefined; + super(SyntaxKind.SourceFile); } public update(newText: string, textChangeRange: TextChangeRange): SourceFile { @@ -660,10 +634,6 @@ export class SourceFileObject implements SourceFile { } } -/** @internal */ -export interface SourceFileObject extends BaseNodeObject {} -Object.setPrototypeOf(SourceFileObject.prototype, BaseNodeObject.prototype); - let scanner: Scanner | undefined; function createChildren(node: Node, sourceFile: SourceFileLike | undefined): readonly Node[] { From 74b510aff25d121d8358ef86a06995d509aca9a1 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 17 Apr 2024 20:58:37 -0400 Subject: [PATCH 22/24] Update baselines --- src/compiler/debug.ts | 5 +- src/compiler/symbolObjectInternals.ts | 7 +- ...Correctly.@@ does not start a new tag.json | 4 +- ...ocComments.parsesCorrectly.@link tags.json | 64 +++++++++--------- ...y.Chained tags, no leading whitespace.json | 10 +-- ...ly.Initial email address is not a tag.json | 2 +- ...esCorrectly.Initial star is not a tag.json | 2 +- ...ectly.Initial star space is not a tag.json | 4 +- ...ts.parsesCorrectly.Nested @param tags.json | 14 ++-- ...sCorrectly.Single trailing whitespace.json | 2 +- ...parsesCorrectly.argSynonymForParamTag.json | 6 +- ...sCorrectly.argumentSynonymForParamTag.json | 6 +- ...parsesCorrectly.asteriskAfterPreamble.json | 6 +- ...DocComments.parsesCorrectly.authorTag.json | 66 +++++++++---------- ...sCorrectly.consecutive newline tokens.json | 4 +- ...Comments.parsesCorrectly.emptyComment.json | 4 +- ...omments.parsesCorrectly.exceptionTag1.json | 8 +-- ...omments.parsesCorrectly.exceptionTag2.json | 4 +- ...omments.parsesCorrectly.exceptionTag3.json | 8 +-- ...ocComments.parsesCorrectly.importTag1.json | 8 +-- ...ocComments.parsesCorrectly.importTag2.json | 12 ++-- ...ocComments.parsesCorrectly.importTag3.json | 10 +-- ...ocComments.parsesCorrectly.importTag4.json | 10 +-- ...ments.parsesCorrectly.leadingAsterisk.json | 6 +- ...less-than and greater-than characters.json | 4 +- ...ly.no space before @ is not a new tag.json | 10 +-- ...nts.parsesCorrectly.noLeadingAsterisk.json | 6 +- ...Comments.parsesCorrectly.noReturnType.json | 4 +- ...cComments.parsesCorrectly.oneParamTag.json | 6 +- ...DocComments.parsesCorrectly.paramTag1.json | 6 +- ...arsesCorrectly.paramTagBracketedName1.json | 6 +- ...arsesCorrectly.paramTagBracketedName2.json | 6 +- ...parsesCorrectly.paramTagNameThenType1.json | 6 +- ...parsesCorrectly.paramTagNameThenType2.json | 6 +- ...ents.parsesCorrectly.paramWithoutType.json | 4 +- ...ocComments.parsesCorrectly.returnTag1.json | 6 +- ...ocComments.parsesCorrectly.returnTag2.json | 6 +- ...cComments.parsesCorrectly.returnsTag1.json | 6 +- ...Comments.parsesCorrectly.satisfiesTag.json | 6 +- ...cComments.parsesCorrectly.templateTag.json | 6 +- ...Comments.parsesCorrectly.templateTag2.json | 8 +-- ...Comments.parsesCorrectly.templateTag3.json | 8 +-- ...Comments.parsesCorrectly.templateTag4.json | 8 +-- ...Comments.parsesCorrectly.templateTag5.json | 8 +-- ...Comments.parsesCorrectly.templateTag6.json | 8 +-- ...mments.parsesCorrectly.threeAsterisks.json | 2 +- ...ocComments.parsesCorrectly.throwsTag1.json | 8 +-- ...ocComments.parsesCorrectly.throwsTag2.json | 4 +- ...ocComments.parsesCorrectly.throwsTag3.json | 8 +-- ...Comments.parsesCorrectly.twoParamTag2.json | 10 +-- ...parsesCorrectly.twoParamTagOnSameLine.json | 10 +-- .../DocComments.parsesCorrectly.typeTag.json | 6 +- ...sCorrectly.typedefTagWithChildrenTags.json | 14 ++-- ...peExpressions.parsesCorrectly.allType.json | 4 +- ...xpressions.parsesCorrectly.arrayType1.json | 4 +- ...xpressions.parsesCorrectly.arrayType2.json | 6 +- ...xpressions.parsesCorrectly.arrayType3.json | 10 +-- ...esCorrectly.callSignatureInRecordType.json | 4 +- ...s.parsesCorrectly.functionReturnType1.json | 6 +- ...essions.parsesCorrectly.functionType1.json | 2 +- ...essions.parsesCorrectly.functionType2.json | 6 +- ...rrectly.functionTypeWithTrailingComma.json | 6 +- ...eExpressions.parsesCorrectly.keyword1.json | 2 +- ...eExpressions.parsesCorrectly.keyword2.json | 2 +- ...ns.parsesCorrectly.methodInRecordType.json | 4 +- ...eExpressions.parsesCorrectly.newType1.json | 8 +-- ...sions.parsesCorrectly.nonNullableType.json | 2 +- ...ions.parsesCorrectly.nonNullableType2.json | 2 +- ...ressions.parsesCorrectly.nullableType.json | 2 +- ...essions.parsesCorrectly.nullableType2.json | 2 +- ...ions.parsesCorrectly.optionalNullable.json | 6 +- ...ressions.parsesCorrectly.optionalType.json | 2 +- ...pressions.parsesCorrectly.recordType1.json | 2 +- ...pressions.parsesCorrectly.recordType2.json | 4 +- ...pressions.parsesCorrectly.recordType3.json | 4 +- ...pressions.parsesCorrectly.recordType4.json | 6 +- ...pressions.parsesCorrectly.recordType5.json | 6 +- ...pressions.parsesCorrectly.recordType6.json | 6 +- ...pressions.parsesCorrectly.recordType7.json | 6 +- ...pressions.parsesCorrectly.recordType8.json | 4 +- ...Expressions.parsesCorrectly.thisType1.json | 8 +-- ...sesCorrectly.topLevelNoParenUnionType.json | 2 +- ...esCorrectly.trailingCommaInRecordType.json | 4 +- ...ons.parsesCorrectly.tsConstructorType.json | 2 +- ...ssions.parsesCorrectly.tsFunctionType.json | 2 +- ...xpressions.parsesCorrectly.tupleType0.json | 2 +- ...xpressions.parsesCorrectly.tupleType1.json | 2 +- ...xpressions.parsesCorrectly.tupleType2.json | 2 +- ...xpressions.parsesCorrectly.tupleType3.json | 2 +- ...sCorrectly.tupleTypeWithTrailingComma.json | 2 +- ...orrectly.typeArgumentsNotFollowingDot.json | 2 +- ...xpressions.parsesCorrectly.typeOfType.json | 2 +- ...ssions.parsesCorrectly.typeReference1.json | 2 +- ...ssions.parsesCorrectly.typeReference2.json | 2 +- ...ssions.parsesCorrectly.typeReference3.json | 4 +- ...Expressions.parsesCorrectly.unionType.json | 4 +- ...orrectly.unionTypeWithLeadingOperator.json | 4 +- ...nTypeWithOneElementAndLeadingOperator.json | 4 +- ...pressions.parsesCorrectly.unknownType.json | 4 +- ...ressions.parsesCorrectly.variadicType.json | 2 +- ...deprecated-ParseForTypeErrors-file.js.diff | 2 +- ...deprecated-ParseForTypeErrors-file.ts.diff | 12 ++-- .../deprecated-ParseForTypeInfo-file.js.diff | 2 +- .../deprecated-ParseForTypeInfo-file.ts.diff | 22 +++---- .../deprecated-ParseNone-file.js.diff | 22 +++---- .../deprecated-ParseNone-file.ts.diff | 22 +++---- .../link-ParseForTypeErrors-file.js.diff | 2 +- .../link-ParseForTypeErrors-file.ts.diff | 2 +- .../link-ParseForTypeInfo-file.js.diff | 2 +- .../link-ParseForTypeInfo-file.ts.diff | 10 +-- .../link-ParseNone-file.js.diff | 10 +-- .../link-ParseNone-file.ts.diff | 10 +-- .../see-ParseForTypeErrors-file.js.diff | 2 +- .../see-ParseForTypeErrors-file.ts.diff | 2 +- .../see-ParseForTypeInfo-file.js.diff | 2 +- .../see-ParseForTypeInfo-file.ts.diff | 30 ++++----- .../see-ParseNone-file.js.diff | 30 ++++----- .../see-ParseNone-file.ts.diff | 30 ++++----- 118 files changed, 433 insertions(+), 425 deletions(-) diff --git a/src/compiler/debug.ts b/src/compiler/debug.ts index 1710c5ed1fb96..205d137d6dd8a 100644 --- a/src/compiler/debug.ts +++ b/src/compiler/debug.ts @@ -93,7 +93,10 @@ import { VarianceFlags, zipWith, } from "./_namespaces/ts"; -import { NodeObject, TokenOrIdentifierObject } from "./nodeConstructors"; +import { + NodeObject, + TokenOrIdentifierObject, +} from "./nodeConstructors"; import { SignatureObject, SymbolObject, diff --git a/src/compiler/symbolObjectInternals.ts b/src/compiler/symbolObjectInternals.ts index 90022d68977e0..c0167849b20b8 100644 --- a/src/compiler/symbolObjectInternals.ts +++ b/src/compiler/symbolObjectInternals.ts @@ -1,5 +1,10 @@ import { SymbolObject } from "./objectConstructors"; -import { JSDocTagInfo, Node, SymbolDisplayPart, TypeChecker } from "./types"; +import { + JSDocTagInfo, + Node, + SymbolDisplayPart, + TypeChecker, +} from "./types"; /** @internal */ export class SymbolObjectInternals { diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json index 919a131de8b1f..43eda754b033f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@@ does not start a new tag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 54, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 52, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json index d89d96f443a7b..3c8c7deed7ca5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.@link tags.json @@ -3,23 +3,23 @@ "pos": 0, "end": 674, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": { "0": { "kind": "JSDocText", "pos": 0, "end": 7, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "" }, "1": { "kind": "JSDocLink", "pos": 7, "end": 21, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 14, @@ -33,16 +33,16 @@ "kind": "JSDocText", "pos": 21, "end": 32, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "\nInside " }, "3": { "kind": "JSDocLink", "pos": 32, "end": 49, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 39, @@ -56,8 +56,8 @@ "kind": "JSDocText", "pos": 49, "end": 59, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " thing" }, "length": 5, @@ -71,8 +71,8 @@ "kind": "JSDocParameterTag", "pos": 59, "end": 102, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 60, @@ -85,22 +85,22 @@ "kind": "JSDocText", "pos": 70, "end": 79, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "See also " }, "1": { "kind": "JSDocLink", "pos": 79, "end": 98, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "QualifiedName", "pos": 86, "end": 97, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 86, @@ -138,8 +138,8 @@ "kind": "JSDocParameterTag", "pos": 102, "end": 589, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 103, @@ -152,16 +152,16 @@ "kind": "JSDocText", "pos": 113, "end": 120, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Or see " }, "1": { "kind": "JSDocLink", "pos": 120, "end": 152, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 127, @@ -175,22 +175,22 @@ "kind": "JSDocText", "pos": 152, "end": 156, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "\n" }, "3": { "kind": "JSDocLink", "pos": 156, "end": 183, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "QualifiedName", "pos": 163, "end": 181, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 163, @@ -212,32 +212,32 @@ "kind": "JSDocText", "pos": 183, "end": 203, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "\nThis empty one: " }, "5": { "kind": "JSDocLink", "pos": 203, "end": 210, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "" }, "6": { "kind": "JSDocText", "pos": 210, "end": 244, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " is OK.\nThis double-space one: " }, "7": { "kind": "JSDocLink", "pos": 244, "end": 262, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 252, @@ -251,22 +251,22 @@ "kind": "JSDocText", "pos": 262, "end": 326, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " is OK too.\nThis should work, despite being badly formatted: " }, "9": { "kind": "JSDocLink", "pos": 326, "end": 340, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "QualifiedName", "pos": 333, "end": 338, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 333, @@ -288,16 +288,16 @@ "kind": "JSDocText", "pos": 340, "end": 369, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "\nForgot to close this one " }, "11": { "kind": "JSDocLink", "pos": 369, "end": 403, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 376, @@ -311,24 +311,24 @@ "kind": "JSDocText", "pos": 403, "end": 526, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " * But it's still OK.\nAlthough it skips the newline so parses the asterisks in the wrong state.\nThis shouldn't work: " }, "13": { "kind": "JSDocLink", "pos": 526, "end": 541, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "* nope" }, "14": { "kind": "JSDocText", "pos": 541, "end": 589, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " * }, because of the intermediate asterisks." }, "length": 15, @@ -351,8 +351,8 @@ "kind": "JSDocAuthorTag", "pos": 589, "end": 672, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 590, @@ -365,24 +365,24 @@ "kind": "JSDocText", "pos": 597, "end": 624, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Alfa Romero " }, "1": { "kind": "JSDocText", "pos": 624, "end": 643, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": " See my home page: " }, "2": { "kind": "JSDocLink", "pos": 643, "end": 670, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 650, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json index b9af20f3a7e83..63235aa838560 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Chained tags, no leading whitespace.json @@ -3,15 +3,15 @@ "pos": 0, "end": 15, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTag", "pos": 3, "end": 6, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 4, @@ -24,8 +24,8 @@ "kind": "JSDocTag", "pos": 6, "end": 9, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -38,8 +38,8 @@ "kind": "JSDocTag", "pos": 9, "end": 11, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 10, @@ -52,8 +52,8 @@ "kind": "JSDocTag", "pos": 11, "end": 13, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 12, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json index 3e5b19e28441e..de101a9765ca2 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial email address is not a tag.json @@ -3,7 +3,7 @@ "pos": 0, "end": 21, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "bill@example.com" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json index db78d23e94b57..46750c7368b32 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star is not a tag.json @@ -3,7 +3,7 @@ "pos": 0, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "*@a" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json index 6c185b409f3f3..894e629dcec29 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Initial star space is not a tag.json @@ -3,16 +3,16 @@ "pos": 0, "end": 9, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "*", "tags": { "0": { "kind": "JSDocTag", "pos": 5, "end": 7, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json index 0b514682bff8d..841f9518ce91b 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Nested @param tags.json @@ -3,15 +3,15 @@ "pos": 0, "end": 66, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 6, "end": 64, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -24,21 +24,21 @@ "kind": "JSDocTypeExpression", "pos": 34, "end": 64, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "JSDocTypeLiteral", "pos": 34, "end": 64, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "jsDocPropertyTags": { "0": { "kind": "JSDocParameterTag", "pos": 34, "end": 64, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 35, @@ -51,8 +51,8 @@ "kind": "JSDocTypeExpression", "pos": 41, "end": 49, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "StringKeyword", "pos": 42, @@ -64,8 +64,8 @@ "kind": "QualifiedName", "pos": 50, "end": 53, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 50, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json index 62bc32517a3ad..2f8223590c0e1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.Single trailing whitespace.json @@ -3,7 +3,7 @@ "pos": 0, "end": 26, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "trailing whitespace" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json index 951af06437d40..43a7e2c42cea4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argSynonymForParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 44, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 42, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 13, "end": 21, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json index 2bc870c1ecf05..ea59b9c0597a4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.argumentSynonymForParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 49, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 47, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 18, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 19, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json index 1a21dce3f0beb..1339748599cc5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.asteriskAfterPreamble.json @@ -3,16 +3,16 @@ "pos": 0, "end": 23, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "*", "tags": { "0": { "kind": "JSDocTypeTag", "pos": 6, "end": 21, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 7, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 12, "end": 20, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 13, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json index 69372d2902068..535a5d4eda7e1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.authorTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 739, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocAuthorTag", "pos": 7, "end": 50, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 8, @@ -24,8 +24,8 @@ "kind": "JSDocText", "pos": 15, "end": 50, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "John Doe " }, "length": 1, @@ -39,8 +39,8 @@ "kind": "JSDocAuthorTag", "pos": 50, "end": 112, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 51, @@ -54,8 +54,8 @@ "kind": "JSDocAuthorTag", "pos": 112, "end": 170, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 113, @@ -69,8 +69,8 @@ "kind": "JSDocAuthorTag", "pos": 170, "end": 227, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 171, @@ -83,8 +83,8 @@ "kind": "JSDocText", "pos": 178, "end": 227, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Multiple Ats " }, "length": 1, @@ -98,8 +98,8 @@ "kind": "JSDocAuthorTag", "pos": 227, "end": 272, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 228, @@ -112,8 +112,8 @@ "kind": "JSDocText", "pos": 235, "end": 272, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Multiple Open Carets " }, "length": 1, @@ -127,8 +127,8 @@ "kind": "JSDocAuthorTag", "pos": 272, "end": 338, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 273, @@ -142,8 +142,8 @@ "kind": "JSDocAuthorTag", "pos": 338, "end": 381, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 339, @@ -156,8 +156,8 @@ "kind": "JSDocText", "pos": 346, "end": 381, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Unclosed Carets " }, "length": 1, @@ -229,8 +229,8 @@ "kind": "JSDocAuthorTag", "pos": 429, "end": 445, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 430, @@ -243,8 +243,8 @@ "kind": "JSDocText", "pos": 437, "end": 445, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Line" }, "length": 1, @@ -258,8 +258,8 @@ "kind": "JSDocAuthorTag", "pos": 445, "end": 453, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 446, @@ -272,8 +272,8 @@ "kind": "JSDocText", "pos": 453, "end": 453, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "" }, "length": 1, @@ -287,8 +287,8 @@ "kind": "JSDocAuthorTag", "pos": 453, "end": 461, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 454, @@ -301,8 +301,8 @@ "kind": "JSDocText", "pos": 461, "end": 461, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "" }, "length": 1, @@ -316,8 +316,8 @@ "kind": "JSDocAuthorTag", "pos": 461, "end": 486, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 462, @@ -330,8 +330,8 @@ "kind": "JSDocText", "pos": 469, "end": 486, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Empty authors" }, "length": 1, @@ -345,8 +345,8 @@ "kind": "JSDocAuthorTag", "pos": 486, "end": 497, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 487, @@ -359,8 +359,8 @@ "kind": "JSDocText", "pos": 497, "end": 497, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "" }, "length": 1, @@ -374,8 +374,8 @@ "kind": "JSDocAuthorTag", "pos": 497, "end": 522, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 498, @@ -388,8 +388,8 @@ "kind": "JSDocText", "pos": 510, "end": 522, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Comments" }, "length": 1, @@ -403,8 +403,8 @@ "kind": "JSDocAuthorTag", "pos": 522, "end": 559, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 523, @@ -417,8 +417,8 @@ "kind": "JSDocText", "pos": 530, "end": 559, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "Early Close Caret > " }, "length": 1, @@ -432,8 +432,8 @@ "kind": "JSDocAuthorTag", "pos": 559, "end": 599, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 560, @@ -447,8 +447,8 @@ "kind": "JSDocTag", "pos": 599, "end": 646, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 600, @@ -462,8 +462,8 @@ "kind": "JSDocAuthorTag", "pos": 646, "end": 737, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 647, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json index aaf9db47d17a1..33f14ebd36287 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.consecutive newline tokens.json @@ -3,15 +3,15 @@ "pos": 0, "end": 55, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTag", "pos": 7, "end": 53, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json index 86a583daecd90..4749058d0c2fc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.emptyComment.json @@ -3,6 +3,6 @@ "pos": 0, "end": 5, "flags": "JSDoc", - "transformFlags": 0, - "modifierFlagsCache": 0 + "modifierFlagsCache": 0, + "transformFlags": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json index d34409f7ff9a8..8793504cc40a5 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 31, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 29, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,14 +23,14 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "TypeReference", "pos": 20, "end": 25, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json index 8b871a13b2829..0226b44843ac7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 45, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 43, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json index 168806d5114e9..a13a8a64c3548 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.exceptionTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 43, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 41, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,14 +24,14 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "TypeReference", "pos": 20, "end": 25, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json index 23fd85f1d88df..817598cb1e86e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 35, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 30, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "ImportClause", "pos": 16, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "isTypeOnly": true, "name": { "kind": "Identifier", @@ -38,8 +38,8 @@ "kind": "StringLiteral", "pos": 24, "end": 30, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json index 32c04e5a14e2a..d11fa4eb24320 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 39, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 34, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,22 +23,22 @@ "kind": "ImportClause", "pos": 16, "end": 23, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "isTypeOnly": true, "namedBindings": { "kind": "NamedImports", "pos": 16, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "elements": { "0": { "kind": "ImportSpecifier", "pos": 17, "end": 21, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "isTypeOnly": false, "name": { "kind": "Identifier", @@ -60,8 +60,8 @@ "kind": "StringLiteral", "pos": 28, "end": 34, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json index 8326aa9845967..a34c07e9983a9 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 42, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 37, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,15 +23,15 @@ "kind": "ImportClause", "pos": 16, "end": 26, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "isTypeOnly": true, "namedBindings": { "kind": "NamespaceImport", "pos": 16, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 20, @@ -45,8 +45,8 @@ "kind": "StringLiteral", "pos": 31, "end": 37, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json index 69553de71532d..e60e392ffb8eb 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.importTag4.json @@ -3,15 +3,15 @@ "pos": 0, "end": 55, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocImportTag", "pos": 8, "end": 53, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,15 +24,15 @@ "kind": "ImportClause", "pos": 16, "end": 26, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "isTypeOnly": true, "namedBindings": { "kind": "NamespaceImport", "pos": 16, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "name": { "kind": "Identifier", "pos": 20, @@ -46,8 +46,8 @@ "kind": "StringLiteral", "pos": 31, "end": 37, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "text": "foo" } }, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json index 4852bf39e48f4..97a20f5e74726 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.leadingAsterisk.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json index 5f9db72ddb4f0..a78806d2b35f3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.less-than and greater-than characters.json @@ -3,15 +3,15 @@ "pos": 0, "end": 61, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 59, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 8, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json index 4a8d426623de8..59070fd2c0fdc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.no space before @ is not a new tag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 91, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 7, "end": 29, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 8, @@ -34,8 +34,8 @@ "kind": "JSDocParameterTag", "pos": 29, "end": 50, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 30, @@ -58,8 +58,8 @@ "kind": "JSDocTag", "pos": 50, "end": 62, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 51, @@ -72,8 +72,8 @@ "kind": "JSDocTag", "pos": 62, "end": 89, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 63, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json index 4852bf39e48f4..97a20f5e74726 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noLeadingAsterisk.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json index dac2baf7ac524..018ca969d65ef 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.noReturnType.json @@ -3,15 +3,15 @@ "pos": 0, "end": 20, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 18, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json index 248ff0c6c6c2b..25d525efd7f8a 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.oneParamTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 34, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 32, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json index 05dc06dba09a3..734e99b221f30 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 59, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 57, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json index ece7ca43da26d..8a9e7fb352a3f 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 61, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 59, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json index 4eb09d521218a..020b0d9437b72 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagBracketedName2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 66, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 64, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json index 066400ca0dbde..a4ae7884303dc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 34, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 32, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 21, "end": 29, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json index 8807f66c58842..29ed1f1a29aba 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramTagNameThenType2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 46, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 44, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 21, "end": 29, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json index 9434b0c795110..132a4ef44e978 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.paramWithoutType.json @@ -3,15 +3,15 @@ "pos": 0, "end": 23, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 21, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json index cfea1e2c90b97..d3951a55fac41 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 29, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 27, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 24, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json index 4345b69cf54cc..5e7639ebc993c 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 54, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 52, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 24, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json index dbc58a03bde8f..b405df418d610 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.returnsTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 30, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocReturnTag", "pos": 8, "end": 28, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 17, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 18, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json index 22a41192ad456..5a5a5dfa77084 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.satisfiesTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 32, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocSatisfiesTag", "pos": 8, "end": 30, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 19, "end": 27, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json index 5a0da5822a73d..468ab95cf8113 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 24, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 22, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json index 41eca0c7bce67..814468541c5d4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 26, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 24, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 20, "end": 21, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 20, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json index 94336d1986d63..c8d415e13ed27 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 21, "end": 22, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 21, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json index 94336d1986d63..c8d415e13ed27 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag4.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 21, "end": 22, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 21, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json index 1caaa65bbbc46..516c270f81ae7 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag5.json @@ -3,15 +3,15 @@ "pos": 0, "end": 28, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,8 +24,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, @@ -38,8 +38,8 @@ "kind": "TypeParameter", "pos": 22, "end": 23, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json index a5eabb5e2f5bc..754b96d70281d 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.templateTag6.json @@ -3,15 +3,15 @@ "pos": 0, "end": 60, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTemplateTag", "pos": 8, "end": 58, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -25,8 +25,8 @@ "kind": "TypeParameter", "pos": 18, "end": 19, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 18, @@ -39,8 +39,8 @@ "kind": "TypeParameter", "pos": 22, "end": 23, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 22, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json index fe92f2b77f734..dc02383e4217e 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.threeAsterisks.json @@ -3,7 +3,7 @@ "pos": 0, "end": 7, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "comment": "*" } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json index eef6a47cfe579..f1e04949611cd 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag1.json @@ -3,15 +3,15 @@ "pos": 0, "end": 28, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 26, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,14 +23,14 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "TypeReference", "pos": 17, "end": 22, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json index acdbbc5651824..c57a789553db3 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 42, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 40, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json index 20b148eb9d16b..dc6e605dc95b1 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.throwsTag3.json @@ -3,15 +3,15 @@ "pos": 0, "end": 40, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocThrowsTag", "pos": 8, "end": 38, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -24,14 +24,14 @@ "kind": "JSDocTypeExpression", "pos": 16, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "TypeReference", "pos": 17, "end": 22, - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json index 323047bd616dd..bb16558e5f9e6 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTag2.json @@ -3,15 +3,15 @@ "pos": 0, "end": 60, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 34, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, @@ -46,8 +46,8 @@ "kind": "JSDocParameterTag", "pos": 34, "end": 58, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 35, @@ -59,8 +59,8 @@ "kind": "JSDocTypeExpression", "pos": 41, "end": 49, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 42, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json index f4da374f163f7..a3b5ddaca61cc 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.twoParamTagOnSameLine.json @@ -3,15 +3,15 @@ "pos": 0, "end": 56, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocParameterTag", "pos": 8, "end": 30, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 15, "end": 23, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 16, @@ -46,8 +46,8 @@ "kind": "JSDocParameterTag", "pos": 30, "end": 54, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 31, @@ -59,8 +59,8 @@ "kind": "JSDocTypeExpression", "pos": 37, "end": 45, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 38, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json index 4852bf39e48f4..97a20f5e74726 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typeTag.json @@ -3,15 +3,15 @@ "pos": 0, "end": 27, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTypeTag", "pos": 8, "end": 25, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,8 +23,8 @@ "kind": "JSDocTypeExpression", "pos": 14, "end": 22, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json index 6651ab40ac97e..dff2bb63fa7c4 100644 --- a/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json +++ b/tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json @@ -3,15 +3,15 @@ "pos": 0, "end": 102, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tags": { "0": { "kind": "JSDocTypedefTag", "pos": 8, "end": 100, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 9, @@ -23,15 +23,15 @@ "kind": "JSDocTypeLiteral", "pos": 8, "end": 100, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "jsDocPropertyTags": { "0": { "kind": "JSDocPropertyTag", "pos": 47, "end": 74, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 48, @@ -43,8 +43,8 @@ "kind": "JSDocTypeExpression", "pos": 57, "end": 65, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 58, @@ -66,8 +66,8 @@ "kind": "JSDocPropertyTag", "pos": 74, "end": 100, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "tagName": { "kind": "Identifier", "pos": 75, @@ -79,8 +79,8 @@ "kind": "JSDocTypeExpression", "pos": 84, "end": 92, - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "StringKeyword", "pos": 85, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json index 852fffaf54b58..b4e63a7851903 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.allType.json @@ -3,6 +3,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "transformFlags": 0, - "modifierFlagsCache": 0 + "modifierFlagsCache": 0, + "transformFlags": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json index 301306828a307..4b4f64ff69668 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType1.json @@ -3,15 +3,15 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elementType": { "kind": "TypeReference", "pos": 1, "end": 2, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json index fd333db7d03f1..c88cf10efeacc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType2.json @@ -3,22 +3,22 @@ "pos": 1, "end": 6, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elementType": { "kind": "ArrayType", "pos": 1, "end": 4, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elementType": { "kind": "TypeReference", "pos": 1, "end": 2, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json index c599013c9850e..e723a54556955 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.arrayType3.json @@ -3,36 +3,36 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "ParenthesizedType", "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "ArrayType", "pos": 2, "end": 7, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elementType": { "kind": "ArrayType", "pos": 2, "end": 5, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elementType": { "kind": "TypeReference", "pos": 2, "end": 3, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json index 006e2d670273b..edc12f8f0b791 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.callSignatureInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "CallSignature", "pos": 2, "end": 12, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "length": 0, "pos": 3, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json index 8e4313fa50202..3ec8a590dcdeb 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionReturnType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 26, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 16, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "StringKeyword", "pos": 10, @@ -26,8 +26,8 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "BooleanKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json index c3e8f069c798c..ed1f75ffcb8c6 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "parameters": { "length": 0, "pos": 10, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json index 8e4313fa50202..3ec8a590dcdeb 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionType2.json @@ -3,16 +3,16 @@ "pos": 1, "end": 26, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 16, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "StringKeyword", "pos": 10, @@ -26,8 +26,8 @@ "pos": 17, "end": 25, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "BooleanKeyword", "pos": 17, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json index 8c57c623a3104..9ee95f4db14bc 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.functionTypeWithTrailingComma.json @@ -3,23 +3,23 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "TypeReference", "pos": 10, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 10, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json index 07667f7cb74ac..d3c1a9b1472a7 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json index 846352917a9d8..eaf113206ee58 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.keyword2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 5, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "literal": { "kind": "NullKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json index f0a84fbbfaffa..2585696a6bf43 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.methodInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "MethodSignature", "pos": 2, "end": 15, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json index 743e8d7dda862..a2f84428ced0e 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.newType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 17, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 10, @@ -26,15 +26,15 @@ "pos": 14, "end": 17, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "QualifiedName", "pos": 14, "end": 17, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json index 7d149f05e77e8..0c26ec3833ddf 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json index 08cae8823aa38..b04300a23ad17 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nonNullableType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json index 934a9af4d23bb..f8bf5398d90db 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json index 30751e5bbee1f..f5a665639c52b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.nullableType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json index b6c7103ea77aa..63ca227cb6028 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalNullable.json @@ -3,14 +3,14 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "JSDocUnknownType", "pos": 1, "end": 2, "flags": "JSDoc", - "transformFlags": 0, - "modifierFlagsCache": 0 + "modifierFlagsCache": 0, + "transformFlags": 0 } } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json index 5e8e08b08d3ee..292b0f4455123 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.optionalType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 8, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json index 9b26032ed1aec..f43b1bdac1823 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json index efc4788e110e5..b861870f7086f 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType2.json @@ -3,16 +3,16 @@ "pos": 1, "end": 6, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 5, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json index 21bae58b1f627..557652828a4be 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType3.json @@ -3,16 +3,16 @@ "pos": 1, "end": 14, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 13, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json index ab34634c5dcb2..75977d52d6bb2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType4.json @@ -3,16 +3,16 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 6, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, @@ -27,8 +27,8 @@ "pos": 6, "end": 10, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json index 949a216767e50..00a156444e6c4 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType5.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 14, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, @@ -34,8 +34,8 @@ "pos": 14, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json index fe1d995cb9310..4c1c1c15488d9 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType6.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 6, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, @@ -27,8 +27,8 @@ "pos": 6, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json index 18f75e0840c55..7d56586d4752d 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType7.json @@ -3,16 +3,16 @@ "pos": 1, "end": 27, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 14, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, @@ -34,8 +34,8 @@ "pos": 14, "end": 26, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 14, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json index 2b1cbe916e06b..e3668abcbb6b6 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.recordType8.json @@ -3,16 +3,16 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 10, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json index 4b28545356ea2..ddb591f737c63 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.thisType1.json @@ -3,16 +3,16 @@ "pos": 1, "end": 19, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "0": { "kind": "Parameter", "pos": 10, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 10, @@ -26,15 +26,15 @@ "pos": 15, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "QualifiedName", "pos": 15, "end": 18, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 15, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json index 0d655b88b677f..89842c75b8732 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.topLevelNoParenUnionType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 14, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json index 5acc58cf56828..12befdc648503 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.trailingCommaInRecordType.json @@ -3,16 +3,16 @@ "pos": 1, "end": 5, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "members": { "0": { "kind": "PropertySignature", "pos": 2, "end": 4, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "name": { "kind": "Identifier", "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json index fd9e8e64c042b..3470d4cd8ac7c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 17, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "length": 0, "pos": 6, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json index 7c8db2b2ca0a2..eeb1dc9dc1bac 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsFunctionType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "parameters": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json index de95c536972d8..d4edc50f085dd 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType0.json @@ -3,8 +3,8 @@ "pos": 1, "end": 3, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elements": { "length": 0, "pos": 2, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json index 1a3e3f7af0598..3720475c1f498 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json index 9823792b1cffc..91d44edea9e43 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json index 54938946ab3df..de7e4268e2509 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleType3.json @@ -3,8 +3,8 @@ "pos": 1, "end": 24, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json index 72c6fb41390a0..3da3449148ff0 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tupleTypeWithTrailingComma.json @@ -3,8 +3,8 @@ "pos": 1, "end": 10, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "elements": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json index 3a66cd5a41113..4c703947ea262 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeArgumentsNotFollowingDot.json @@ -3,8 +3,8 @@ "pos": 1, "end": 4, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json index ab170167fd78c..a04f845079020 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeOfType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 9, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "exprName": { "kind": "Identifier", "pos": 7, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json index 11251cbe4cd05..647246c631010 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference1.json @@ -3,8 +3,8 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json index 786344ade9837..5e738719c513d 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference2.json @@ -3,8 +3,8 @@ "pos": 1, "end": 18, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json index 834041ea8ae8e..117fad0686e2c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.typeReference3.json @@ -3,15 +3,15 @@ "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "typeName": { "kind": "QualifiedName", "pos": 1, "end": 11, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "left": { "kind": "Identifier", "pos": 1, diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json index c1dc136d57727..93be2ef86cd5b 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionType.json @@ -3,15 +3,15 @@ "pos": 1, "end": 16, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "UnionType", "pos": 2, "end": 15, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json index 8d95996f80a9c..1238bc87c974d 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithLeadingOperator.json @@ -3,15 +3,15 @@ "pos": 1, "end": 22, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "UnionType", "pos": 2, "end": 20, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json index d0d61b07993f0..d013dcf9fa55c 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unionTypeWithOneElementAndLeadingOperator.json @@ -3,15 +3,15 @@ "pos": 1, "end": 13, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "type": { "kind": "UnionType", "pos": 2, "end": 11, "flags": "JSDoc", - "transformFlags": 1, "modifierFlagsCache": 0, + "transformFlags": 1, "types": { "0": { "kind": "NumberKeyword", diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json index e3b445d9a39cf..b68503ba281ca 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.unknownType.json @@ -3,6 +3,6 @@ "pos": 1, "end": 2, "flags": "JSDoc", - "transformFlags": 0, - "modifierFlagsCache": 0 + "modifierFlagsCache": 0, + "transformFlags": 0 } \ No newline at end of file diff --git a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json index 1a2ecb1254563..6ec84fc8faba2 100644 --- a/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json +++ b/tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.variadicType.json @@ -3,8 +3,8 @@ "pos": 1, "end": 10, "flags": "JSDoc", - "transformFlags": 0, "modifierFlagsCache": 0, + "transformFlags": 0, "type": { "kind": "NumberKeyword", "pos": 4, diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff index 5677dccfb35f1..663c0633bf173 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -229,7 +229,7 @@ +@@ -230,7 +230,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff index 32b78ad3bc403..c50da716b91b9 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeErrors-file.ts.diff @@ -1,17 +1,17 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -7,9 +7,8 @@ +@@ -8,9 +8,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, "end": 46, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -38,42 +37,9 @@ +@@ -39,42 +38,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -55,7 +55,7 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -229,6 +195,6 @@ +@@ -230,6 +196,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff index a97fbf3ce5868..f700c77c48c7f 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -229,7 +229,7 @@ +@@ -230,7 +230,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff index 2f16dad9909f7..f63d4526fd75c 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseForTypeInfo-file.ts.diff @@ -1,17 +1,17 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -7,9 +7,8 @@ +@@ -8,9 +8,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, "end": 46, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -38,42 +37,9 @@ +@@ -39,42 +38,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -55,17 +55,17 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -105,9 +71,8 @@ +@@ -106,9 +72,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, "end": 135, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -136,43 +101,9 @@ +@@ -137,43 +102,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -229,6 +160,6 @@ +@@ -230,6 +161,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff index efc520d7027e7..567ff8973d13a 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.js.diff @@ -1,17 +1,17 @@ =================================================================== --- default +++ ParseNone -@@ -7,9 +7,8 @@ +@@ -8,9 +8,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, "end": 46, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -38,42 +37,9 @@ +@@ -39,42 +38,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -55,17 +55,17 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -105,9 +71,8 @@ +@@ -106,9 +72,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, "end": 135, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -136,43 +101,9 @@ +@@ -137,43 +102,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -229,7 +160,6 @@ +@@ -230,7 +161,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff index 02550c8a510a6..852412d8420f3 100644 --- a/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/deprecated-ParseNone-file.ts.diff @@ -1,17 +1,17 @@ =================================================================== --- default +++ ParseNone -@@ -7,9 +7,8 @@ +@@ -8,9 +8,8 @@ "0": { "kind": "FunctionDeclaration", "pos": 0, "end": 46, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -38,42 +37,9 @@ +@@ -39,42 +38,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -23,16 +23,16 @@ - "pos": 1, - "end": 19, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocDeprecatedTag", - "pos": 5, - "end": 17, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 6, @@ -55,17 +55,17 @@ "1": { "kind": "ExpressionStatement", "pos": 46, -@@ -105,9 +71,8 @@ +@@ -106,9 +72,8 @@ "2": { "kind": "FunctionDeclaration", "pos": 61, "end": 135, - "flags": "Deprecated", - "transformFlags": 4194304, "modifierFlagsCache": 0, + "transformFlags": 4194304, "name": { "kind": "Identifier", -@@ -136,43 +101,9 @@ +@@ -137,43 +102,9 @@ "hasTrailingComma": false, "transformFlags": 0 }, @@ -77,8 +77,8 @@ - "pos": 62, - "end": 107, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": "{@see imDeprecated}", - "tags": { - "0": { @@ -86,8 +86,8 @@ - "pos": 92, - "end": 105, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 93, @@ -110,7 +110,7 @@ "3": { "kind": "ExpressionStatement", "pos": 135, -@@ -229,6 +160,6 @@ +@@ -230,6 +161,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff index 494c3aeb461ff..e85d3dac9427d 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -213,7 +213,7 @@ +@@ -214,7 +214,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff index 0af7fab532413..d54b75b0af7d6 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeErrors-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -213,6 +213,6 @@ +@@ -214,6 +214,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff index 5a045b4126e5e..894c809d38c7e 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -213,7 +213,7 @@ +@@ -214,7 +214,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff index 97006eaa01077..0c2bff5a4677e 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseForTypeInfo-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -87,52 +87,9 @@ +@@ -88,52 +88,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 43, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -213,6 +170,6 @@ +@@ -214,6 +171,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff index f2794586845c2..3a1028bb08254 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -87,52 +87,9 @@ +@@ -88,52 +88,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 43, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -213,7 +170,6 @@ +@@ -214,7 +171,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff index c068b27668d49..41135dc2495ba 100644 --- a/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/link-ParseNone-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -87,52 +87,9 @@ +@@ -88,52 +88,9 @@ "pos": 69, "end": 69, "hasTrailingComma": false, @@ -13,16 +13,16 @@ - "pos": 32, - "end": 48, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "comment": { - "0": { - "kind": "JSDocText", - "pos": 32, - "end": 36, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -30,8 +30,8 @@ - "pos": 36, - "end": 45, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 43, @@ -55,7 +55,7 @@ "length": 2, "pos": 0, "end": 70, -@@ -213,6 +170,6 @@ +@@ -214,6 +171,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff index 0baa7c08790ad..8cd70cc2c15d5 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -294,7 +294,7 @@ +@@ -295,7 +295,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff index d1b5af6de2196..e02a89d1bca31 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeErrors-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeErrors -@@ -294,6 +294,6 @@ +@@ -295,6 +295,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff index b68bf681217f4..85dc2f66b7242 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -294,7 +294,7 @@ +@@ -295,7 +295,7 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff index 9a981be43bd63..277a3fbe56a55 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseForTypeInfo-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseForTypeInfo -@@ -37,235 +37,9 @@ +@@ -38,235 +38,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 94, @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -294,6 +68,6 @@ +@@ -295,6 +69,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff index 86c814e76714c..cae5537d772c6 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.js.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -37,235 +37,9 @@ +@@ -38,235 +38,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 94, @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -294,7 +68,6 @@ +@@ -295,7 +69,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], diff --git a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff index 5f145a39982a3..d89f8511e680a 100644 --- a/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff +++ b/tests/baselines/reference/skipJSDocParsing/see-ParseNone-file.ts.diff @@ -1,7 +1,7 @@ =================================================================== --- default +++ ParseNone -@@ -37,235 +37,9 @@ +@@ -38,235 +38,9 @@ "end": 108, "hasTrailingComma": false, "transformFlags": 0 @@ -13,16 +13,16 @@ - "pos": 1, - "end": 28, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocTypedefTag", - "pos": 8, - "end": 24, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 9, @@ -36,8 +36,8 @@ - "pos": 17, - "end": 22, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "type": { - "kind": "AnyKeyword", - "pos": 18, @@ -75,16 +75,16 @@ - "pos": 30, - "end": 100, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tags": { - "0": { - "kind": "JSDocSeeTag", - "pos": 37, - "end": 55, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 38, @@ -99,8 +99,8 @@ - "pos": 42, - "end": 42, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -108,8 +108,8 @@ - "pos": 42, - "end": 51, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 49, @@ -132,8 +132,8 @@ - "pos": 55, - "end": 77, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 56, @@ -148,8 +148,8 @@ - "pos": 60, - "end": 60, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -157,8 +157,8 @@ - "pos": 60, - "end": 73, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 71, @@ -181,8 +181,8 @@ - "pos": 77, - "end": 98, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "tagName": { - "kind": "Identifier", - "pos": 78, @@ -197,8 +197,8 @@ - "pos": 82, - "end": 82, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "text": "" - }, - "1": { @@ -206,8 +206,8 @@ - "pos": 82, - "end": 96, - "flags": "JSDoc", -- "transformFlags": 0, - "modifierFlagsCache": 0, +- "transformFlags": 0, - "name": { - "kind": "Identifier", - "pos": 94, @@ -238,7 +238,7 @@ "length": 1, "pos": 0, "end": 109, -@@ -294,6 +68,6 @@ +@@ -295,6 +69,6 @@ "typeReferenceDirectives": [], "libReferenceDirectives": [], "amdDependencies": [], From 9e56c70e493d93a7989b18365fdd8d069b8f2bb6 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Wed, 17 Apr 2024 21:30:59 -0400 Subject: [PATCH 23/24] Don't mutate SignatureObject from services --- src/compiler/objectConstructors.ts | 5 +++-- src/compiler/signatureObjectInternals.ts | 16 ++++++++++++++++ src/services/services.ts | 22 ++++++++++++++-------- 3 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/compiler/signatureObjectInternals.ts diff --git a/src/compiler/objectConstructors.ts b/src/compiler/objectConstructors.ts index 4e78bd788fdef..c1a2a1654c006 100644 --- a/src/compiler/objectConstructors.ts +++ b/src/compiler/objectConstructors.ts @@ -42,6 +42,7 @@ import { UnionOrIntersectionType, UnionType, } from "./_namespaces/ts"; +import { SignatureObjectInternals } from "./signatureObjectInternals"; import { SymbolObjectInternals } from "./symbolObjectInternals"; /** @internal */ @@ -316,11 +317,11 @@ export class SignatureObject implements Signature { } getDocumentationComment(): SymbolDisplayPart[] { - throw new TypeError("Not implemented"); + return SignatureObjectInternals.internals.getDocumentationComment(this); } getJsDocTags(): JSDocTagInfo[] { - throw new TypeError("Not implemented"); + return SignatureObjectInternals.internals.getJsDocTags(this); } } diff --git a/src/compiler/signatureObjectInternals.ts b/src/compiler/signatureObjectInternals.ts new file mode 100644 index 0000000000000..296305e73e837 --- /dev/null +++ b/src/compiler/signatureObjectInternals.ts @@ -0,0 +1,16 @@ +import { JSDocTagInfo, Signature, SymbolDisplayPart } from "./types"; + +/** @internal */ +export class SignatureObjectInternals { + static internals = new SignatureObjectInternals(); + + getDocumentationComment(signature: Signature): SymbolDisplayPart[]; + getDocumentationComment(_signature: Signature): SymbolDisplayPart[] { + throw new TypeError("Not implemented."); + } + + getJsDocTags(signature: Signature): JSDocTagInfo[]; + getJsDocTags(_signature: Signature): JSDocTagInfo[] { + throw new TypeError("Not implemented."); + } +} diff --git a/src/services/services.ts b/src/services/services.ts index ba5a3b8d7732c..b6e643d44766c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,6 +2,7 @@ import { SignatureObject, SymbolObject, } from "../compiler/objectConstructors"; +import { SignatureObjectInternals } from "../compiler/signatureObjectInternals"; import { SymbolObjectInternals } from "../compiler/symbolObjectInternals"; import { __String, @@ -374,15 +375,20 @@ function ensureSignatureExtraFields(signature: Signature) { return extra; } -SignatureObject.prototype.getDocumentationComment = function (this: Signature): SymbolDisplayPart[] { - const extra = ensureSignatureExtraFields(this); - return extra.documentationComment ??= getDocumentationComment(singleElementArray(this.declaration), this.checker); -}; +class ServicesSignatureObjectInternals extends SignatureObjectInternals { + override getDocumentationComment(signature: Signature): SymbolDisplayPart[] { + const extra = ensureSignatureExtraFields(signature); + return extra.documentationComment ??= getDocumentationComment(singleElementArray(signature.declaration), signature.checker); + } -SignatureObject.prototype.getJsDocTags = function (this: Signature): JSDocTagInfo[] { - const extra = ensureSignatureExtraFields(this); - return extra.jsDocTags ??= getJsDocTagsOfDeclarations(singleElementArray(this.declaration), this.checker); -}; + override getJsDocTags(signature: Signature): JSDocTagInfo[] { + const extra = ensureSignatureExtraFields(signature); + return extra.jsDocTags ??= getJsDocTagsOfDeclarations(singleElementArray(signature.declaration), signature.checker); + } +} + +// Override the internals for signatures +SignatureObjectInternals.internals = new ServicesSignatureObjectInternals(); /** * Returns whether or not the given node has a JSDoc "inheritDoc" tag on it. From 1f0d71f415888e8f8472060535d0d6ba0a54b207 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Thu, 18 Apr 2024 12:16:23 -0400 Subject: [PATCH 24/24] Fix format and lint --- src/compiler/signatureObjectInternals.ts | 8 ++++++-- src/services/services.ts | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/compiler/signatureObjectInternals.ts b/src/compiler/signatureObjectInternals.ts index 296305e73e837..0437809e7ff1c 100644 --- a/src/compiler/signatureObjectInternals.ts +++ b/src/compiler/signatureObjectInternals.ts @@ -1,4 +1,8 @@ -import { JSDocTagInfo, Signature, SymbolDisplayPart } from "./types"; +import { + JSDocTagInfo, + Signature, + SymbolDisplayPart, +} from "./types"; /** @internal */ export class SignatureObjectInternals { @@ -8,7 +12,7 @@ export class SignatureObjectInternals { getDocumentationComment(_signature: Signature): SymbolDisplayPart[] { throw new TypeError("Not implemented."); } - + getJsDocTags(signature: Signature): JSDocTagInfo[]; getJsDocTags(_signature: Signature): JSDocTagInfo[] { throw new TypeError("Not implemented."); diff --git a/src/services/services.ts b/src/services/services.ts index b6e643d44766c..40c5788485b6c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -1,5 +1,4 @@ import { - SignatureObject, SymbolObject, } from "../compiler/objectConstructors"; import { SignatureObjectInternals } from "../compiler/signatureObjectInternals"; @@ -250,7 +249,6 @@ import { TodoCommentDescriptor, toPath, tracing, - TransientSymbol, Type, TypeChecker, typeToDisplayParts,