From 1a4825238513228e3ca8fe114b0d133a6eeddbab Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Fri, 5 Apr 2024 16:32:21 -0400 Subject: [PATCH] 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 c1a5e5bd63c..38451367bb6 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 56ca98b0bf4..2aa31b9f1eb 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 d876d70b468..9b571b50580 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 43f3a75903a..cb836a7458d 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 bdec56609c2..630172aa4f0 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 be2b81ed8e0..1b8d85d0646 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 4c33ede1d65..9989f809c7e 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 65ce1c40130..de0cfc755b6 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 99311f93c05..0c5ad370d2f 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,