Skip to content

Commit 6fc5cb8

Browse files
authored
createNodeBuilder, declaration emit, and associated utility port (#791)
1 parent f4022d3 commit 6fc5cb8

File tree

9,452 files changed

+348539
-205152
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

9,452 files changed

+348539
-205152
lines changed

internal/ast/ast.go

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,10 @@ func (n *Node) AsNotEmittedStatement() *NotEmittedStatement {
14481448
return n.data.(*NotEmittedStatement)
14491449
}
14501450

1451+
func (n *Node) AsNotEmittedTypeElement() *NotEmittedTypeElement {
1452+
return n.data.(*NotEmittedTypeElement)
1453+
}
1454+
14511455
func (n *Node) AsJSDoc() *JSDoc {
14521456
return n.data.(*JSDoc)
14531457
}
@@ -4035,6 +4039,28 @@ func IsNotEmittedStatement(node *Node) bool {
40354039
return node.Kind == KindNotEmittedStatement
40364040
}
40374041

4042+
// NotEmittedTypeElement
4043+
4044+
// Represents a type element that is elided as part of a transformation to emit comments on a
4045+
// not-emitted node.
4046+
type NotEmittedTypeElement struct {
4047+
NodeBase
4048+
TypeElementBase
4049+
}
4050+
4051+
func (f *NodeFactory) NewNotEmittedTypeElement() *Node {
4052+
data := &NotEmittedTypeElement{}
4053+
return newNode(KindNotEmittedTypeElement, data, f.hooks)
4054+
}
4055+
4056+
func (node *NotEmittedTypeElement) Clone(f NodeFactoryCoercible) *Node {
4057+
return cloneNode(f.AsNodeFactory().NewNotEmittedTypeElement(), node.AsNode(), f.AsNodeFactory().hooks)
4058+
}
4059+
4060+
func IsNotEmittedTypeElement(node *Node) bool {
4061+
return node.Kind == KindNotEmittedTypeElement
4062+
}
4063+
40384064
// ImportEqualsDeclaration
40394065

40404066
type ImportEqualsDeclaration struct {
@@ -9925,7 +9951,7 @@ type SourceFile struct {
99259951
UsesUriStyleNodeCoreModules core.Tristate
99269952
Identifiers map[string]string
99279953
IdentifierCount int
9928-
Imports []*LiteralLikeNode // []LiteralLikeNode
9954+
imports []*LiteralLikeNode // []LiteralLikeNode
99299955
ModuleAugmentations []*ModuleName // []ModuleName
99309956
AmbientModuleNames []string
99319957
CommentDirectives []CommentDirective
@@ -9996,6 +10022,14 @@ func (node *SourceFile) Path() tspath.Path {
999610022
return node.path
999710023
}
999810024

10025+
func (node *SourceFile) OriginalFileName() string {
10026+
return node.FileName() // !!! redirect source files
10027+
}
10028+
10029+
func (node *SourceFile) Imports() []*LiteralLikeNode {
10030+
return node.imports
10031+
}
10032+
999910033
func (node *SourceFile) Diagnostics() []*Diagnostic {
1000010034
return node.diagnostics
1000110035
}
@@ -10036,6 +10070,10 @@ func (node *SourceFile) VisitEachChild(v *NodeVisitor) *Node {
1003610070
return v.Factory.UpdateSourceFile(node, v.visitTopLevelStatements(node.Statements))
1003710071
}
1003810072

10073+
func (node *SourceFile) IsJS() bool {
10074+
return IsSourceFileJS(node)
10075+
}
10076+
1003910077
func (node *SourceFile) copyFrom(other *SourceFile) {
1004010078
// Do not copy fields set by NewSourceFile (Text, FileName, Path, or Statements)
1004110079
node.LanguageVersion = other.LanguageVersion
@@ -10045,7 +10083,7 @@ func (node *SourceFile) copyFrom(other *SourceFile) {
1004510083
node.HasNoDefaultLib = other.HasNoDefaultLib
1004610084
node.UsesUriStyleNodeCoreModules = other.UsesUriStyleNodeCoreModules
1004710085
node.Identifiers = other.Identifiers
10048-
node.Imports = other.Imports
10086+
node.imports = other.imports
1004910087
node.ModuleAugmentations = other.ModuleAugmentations
1005010088
node.AmbientModuleNames = other.AmbientModuleNames
1005110089
node.CommentDirectives = other.CommentDirectives

internal/ast/kind.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,7 @@ const (
387387
KindPartiallyEmittedExpression
388388
KindCommaListExpression
389389
KindSyntheticReferenceExpression
390+
KindNotEmittedTypeElement
390391
// Enum value count
391392
KindCount
392393
// Markers

internal/ast/kind_stringer_generated.go

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)