Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
56 lines (49 loc) · 2.68 KB

File metadata and controls

56 lines (49 loc) · 2.68 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* @internal */
namespace 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: SyntaxKind): Node;
createBaseIdentifierNode(kind: SyntaxKind): Node;
createBasePrivateIdentifierNode(kind: SyntaxKind): 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.
*/
export function createBaseNodeFactory(): BaseNodeFactory {
// tslint:disable variable-name
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;
// tslint:enable variable-name
return {
createBaseSourceFileNode,
createBaseIdentifierNode,
createBasePrivateIdentifierNode,
createBaseTokenNode,
createBaseNode
};
function createBaseSourceFileNode(kind: SyntaxKind): Node {
return new (SourceFileConstructor || (SourceFileConstructor = objectAllocator.getSourceFileConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
function createBaseIdentifierNode(kind: SyntaxKind): Node {
return new (IdentifierConstructor || (IdentifierConstructor = objectAllocator.getIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
function createBasePrivateIdentifierNode(kind: SyntaxKind): Node {
return new (PrivateIdentifierConstructor || (PrivateIdentifierConstructor = objectAllocator.getPrivateIdentifierConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
function createBaseTokenNode(kind: SyntaxKind): Node {
return new (TokenConstructor || (TokenConstructor = objectAllocator.getTokenConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
function createBaseNode(kind: SyntaxKind): Node {
return new (NodeConstructor || (NodeConstructor = objectAllocator.getNodeConstructor()))(kind, /*pos*/ -1, /*end*/ -1);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.