Skip to content

Commit

Permalink
Generated module conversion step - inlineImports
Browse files Browse the repository at this point in the history
This step converts as many explicit accesses as possible in favor of direct imports from the modules in which things were declared. This restores the code (as much as possible) back to how it looked originally before the explicitify step, e.g. instead of "ts.Node" and "ts.Symbol", we have just "Node" and "Symbol".
  • Loading branch information
jakebailey committed Nov 6, 2022
1 parent 70b4b5e commit 40b963a
Show file tree
Hide file tree
Showing 240 changed files with 59,371 additions and 56,342 deletions.
2,414 changes: 1,237 additions & 1,177 deletions src/compiler/binder.ts

Large diffs are not rendered by default.

659 changes: 337 additions & 322 deletions src/compiler/builder.ts

Large diffs are not rendered by default.

75 changes: 40 additions & 35 deletions src/compiler/builderPublic.ts

Large diffs are not rendered by default.

193 changes: 100 additions & 93 deletions src/compiler/builderState.ts

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/compiler/builderStatePublic.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import * as ts from "./_namespaces/ts";
import { BuildInfo, Diagnostic } from "./_namespaces/ts";

export interface EmitOutput {
outputFiles: OutputFile[];
emitSkipped: boolean;
/* @internal */ diagnostics: readonly ts.Diagnostic[];
/* @internal */ diagnostics: readonly Diagnostic[];
}

export interface OutputFile {
name: string;
writeByteOrderMark: boolean;
text: string;
/* @internal */ buildInfo?: ts.BuildInfo
/* @internal */ buildInfo?: BuildInfo
}
26,860 changes: 13,529 additions & 13,331 deletions src/compiler/checker.ts

Large diffs are not rendered by default.

1,669 changes: 845 additions & 824 deletions src/compiler/commandLineParser.ts

Large diffs are not rendered by default.

338 changes: 171 additions & 167 deletions src/compiler/core.ts

Large diffs are not rendered by default.

477 changes: 247 additions & 230 deletions src/compiler/debug.ts

Large diffs are not rendered by default.

3,346 changes: 1,713 additions & 1,633 deletions src/compiler/emitter.ts

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions src/compiler/factory/baseNodeFactory.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import * as ts from "../_namespaces/ts";
import { Node, objectAllocator, 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(kind: ts.SyntaxKind): ts.Node;
createBaseIdentifierNode(kind: ts.SyntaxKind): ts.Node;
createBasePrivateIdentifierNode(kind: ts.SyntaxKind): ts.Node;
createBaseTokenNode(kind: ts.SyntaxKind): ts.Node;
createBaseNode(kind: ts.SyntaxKind): ts.Node;
createBaseSourceFileNode(kind: SyntaxKind): Node;
createBaseIdentifierNode(kind: SyntaxKind): Node;
createBasePrivateIdentifierNode(kind: SyntaxKind): Node;
createBaseTokenNode(kind: SyntaxKind): Node;
createBaseNode(kind: SyntaxKind): Node;
}

/** @internal */
/**
* Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
*/
export function createBaseNodeFactory(): BaseNodeFactory {
let NodeConstructor: new (kind: ts.SyntaxKind, pos?: number, end?: number) => ts.Node;
let TokenConstructor: new (kind: ts.SyntaxKind, pos?: number, end?: number) => ts.Node;
let IdentifierConstructor: new (kind: ts.SyntaxKind, pos?: number, end?: number) => ts.Node;
let PrivateIdentifierConstructor: new (kind: ts.SyntaxKind, pos?: number, end?: number) => ts.Node;
let SourceFileConstructor: new (kind: ts.SyntaxKind, pos?: number, end?: number) => ts.Node;
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,
Expand All @@ -32,23 +32,23 @@ export function createBaseNodeFactory(): BaseNodeFactory {
createBaseNode
};

function createBaseSourceFileNode(kind: ts.SyntaxKind): ts.Node {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
function createBaseSourceFileNode(kind: SyntaxKind): Node {
return new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}

function createBaseIdentifierNode(kind: ts.SyntaxKind): ts.Node {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
function createBaseIdentifierNode(kind: SyntaxKind): Node {
return new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}

function createBasePrivateIdentifierNode(kind: ts.SyntaxKind): ts.Node {
return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = ts.objectAllocator.getPrivateIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
function createBasePrivateIdentifierNode(kind: SyntaxKind): Node {
return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}

function createBaseTokenNode(kind: ts.SyntaxKind): ts.Node {
return new (TokenConstructor || (TokenConstructor = ts.objectAllocator.getTokenConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
function createBaseTokenNode(kind: SyntaxKind): Node {
return new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}

function createBaseNode(kind: ts.SyntaxKind): ts.Node {
return new (NodeConstructor || (NodeConstructor = ts.objectAllocator.getNodeConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
function createBaseNode(kind: SyntaxKind): Node {
return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
}
Loading

0 comments on commit 40b963a

Please sign in to comment.