Skip to content

createNodeBuilder, declaration emit, and associated utility port #791

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6f8b70e
Wire up type printing to use node builder, port most type printback l…
weswigham Feb 11, 2025
5190004
Pull in a chunk of declaration emit integrations from older work
weswigham Apr 16, 2025
3dac2d2
Last half of the declaration transform and emit resolver, bar !!!d fe…
weswigham Apr 18, 2025
b1c7164
Add missing name check, fix some NPEs, swap symbolToString from stub …
weswigham Apr 18, 2025
10500fd
Port old, inefficient symbol accesibility checking methods
weswigham Apr 18, 2025
76528fa
Nodebuilder symbol chain lookup logic & symbol manufacturing logic, s…
weswigham Apr 21, 2025
b60f514
Last of the core norebuilder functionality
weswigham Apr 22, 2025
c92cf8e
Fix inverted typeof usage condition
weswigham Apr 22, 2025
bcf20a7
Add some missing map initialization checks
weswigham Apr 22, 2025
99c5b27
Bugfixes aplenty
weswigham Apr 22, 2025
2050781
Fix all the panics and deadlocks exposed by the test suite, implement…
weswigham Apr 23, 2025
1d83436
Fix whitespace differentials, type arg list printback in diags, overl…
weswigham Apr 23, 2025
1e5b5a5
Fix declaration emit for const refs to enums
weswigham Apr 23, 2025
6fc5379
Use more strada-accurate baseline type printing to correct unique sym…
weswigham Apr 23, 2025
867d830
Fix some symbol chain printback issues
weswigham Apr 23, 2025
c9ec9c4
Replacement for collectLinkedAliases thats noCheck compatible by default
weswigham Apr 24, 2025
eebc5da
Partial specifier generation implementation, still missing the meat a…
weswigham Apr 26, 2025
d744420
specifier generation basically completely ported, sans host functiona…
weswigham Apr 26, 2025
30ffd41
Implement/stub missing emithost functionality for specifier generation
weswigham Apr 26, 2025
99c1066
set Checker Host member, is now minimally a ModuleSpecifierGeneration…
weswigham Apr 26, 2025
2d566b1
namespace keyword over module in declaration emit, fix double indent …
weswigham Apr 28, 2025
f0bb1cc
Merge branch 'main' into nodebuilder
weswigham Apr 28, 2025
d6972ae
Remove vestigial parameter modifier masking, elide empty heritage cla…
weswigham Apr 28, 2025
7f79751
Enable declaration maps
weswigham Apr 28, 2025
443938a
Collect and sort results of export table traversals throughout symbol…
weswigham May 1, 2025
79deafd
Merge branch 'main' into nodebuilder
weswigham May 1, 2025
78adb94
Apparently go fmt and dprint differ in how they format comments!
weswigham May 1, 2025
7f9051e
Stop triple-negating negative numeric literals
weswigham May 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions internal/ast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,10 @@ func (n *Node) AsNotEmittedStatement() *NotEmittedStatement {
return n.data.(*NotEmittedStatement)
}

func (n *Node) AsNotEmittedTypeElement() *NotEmittedTypeElement {
return n.data.(*NotEmittedTypeElement)
}

func (n *Node) AsJSDoc() *JSDoc {
return n.data.(*JSDoc)
}
Expand Down Expand Up @@ -3964,6 +3968,28 @@ func IsNotEmittedStatement(node *Node) bool {
return node.Kind == KindNotEmittedStatement
}

// NotEmittedStatement

// Represents a type element that is elided as part of a transformation to emit comments on a
// not-emitted node.
type NotEmittedTypeElement struct {
NodeBase
TypeElementBase
}

func (f *NodeFactory) NewNotEmittedTypeElement() *Node {
data := &NotEmittedTypeElement{}
return newNode(KindNotEmittedTypeElement, data, f.hooks)
}

func (node *NotEmittedTypeElement) Clone(f NodeFactoryCoercible) *Node {
return cloneNode(f.AsNodeFactory().NewNotEmittedTypeElement(), node.AsNode(), f.AsNodeFactory().hooks)
}

func IsNotEmittedTypeElement(node *Node) bool {
return node.Kind == KindNotEmittedTypeElement
}

// ImportEqualsDeclaration

type ImportEqualsDeclaration struct {
Expand Down Expand Up @@ -9842,7 +9868,7 @@ type SourceFile struct {
UsesUriStyleNodeCoreModules core.Tristate
Identifiers map[string]string
IdentifierCount int
Imports []*LiteralLikeNode // []LiteralLikeNode
imports []*LiteralLikeNode // []LiteralLikeNode
ModuleAugmentations []*ModuleName // []ModuleName
AmbientModuleNames []string
CommentDirectives []CommentDirective
Expand Down Expand Up @@ -9913,6 +9939,14 @@ func (node *SourceFile) Path() tspath.Path {
return node.path
}

func (node *SourceFile) OriginalFileName() string {
return node.FileName() // !!! redirect source files
}

func (node *SourceFile) Imports() []*LiteralLikeNode {
return node.imports
}

func (node *SourceFile) Diagnostics() []*Diagnostic {
return node.diagnostics
}
Expand Down Expand Up @@ -9953,6 +9987,10 @@ func (node *SourceFile) VisitEachChild(v *NodeVisitor) *Node {
return v.Factory.UpdateSourceFile(node, v.visitTopLevelStatements(node.Statements))
}

func (node *SourceFile) IsJS() bool {
return IsSourceFileJS(node)
}

func (node *SourceFile) copyFrom(other *SourceFile) {
// Do not copy fields set by NewSourceFile (Text, FileName, Path, or Statements)
node.LanguageVersion = other.LanguageVersion
Expand All @@ -9962,7 +10000,7 @@ func (node *SourceFile) copyFrom(other *SourceFile) {
node.HasNoDefaultLib = other.HasNoDefaultLib
node.UsesUriStyleNodeCoreModules = other.UsesUriStyleNodeCoreModules
node.Identifiers = other.Identifiers
node.Imports = other.Imports
node.imports = other.imports
node.ModuleAugmentations = other.ModuleAugmentations
node.AmbientModuleNames = other.AmbientModuleNames
node.CommentDirectives = other.CommentDirectives
Expand Down
1 change: 1 addition & 0 deletions internal/ast/kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ const (
KindPartiallyEmittedExpression
KindCommaListExpression
KindSyntheticReferenceExpression
KindNotEmittedTypeElement
// Enum value count
KindCount
// Markers
Expand Down
7 changes: 4 additions & 3 deletions internal/ast/kind_stringer_generated.go

Large diffs are not rendered by default.

Loading
Loading