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 45 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 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
6a3e11c
Fix some discrepencies and make error.txt baselines include declarati…
weswigham May 1, 2025
f5f299b
Add missing default typeformatflags to typeToString
weswigham May 1, 2025
c44123b
Fix mapped type +-
weswigham May 1, 2025
5660f03
Add missing EFNoAsciiEscaping flag on string literal type printback
weswigham May 1, 2025
ffa0b5c
Fix transposition of token
weswigham May 1, 2025
bc86f35
Add JS support to declaration transformer (currently untested in base…
weswigham May 1, 2025
e16f105
Merge branch 'main' into nodebuilder
weswigham May 5, 2025
c66110f
Merge branch 'main' into nodebuilder
weswigham May 15, 2025
2698d45
Requested specifier generation refactor
weswigham May 15, 2025
7d7c6d5
Review feedback round one
weswigham May 15, 2025
2555e62
Fix panic from JS changes
weswigham May 15, 2025
9b7d234
Actually remove the new-dead code
weswigham May 15, 2025
20b3740
Merge branch 'main' into nodebuilder
weswigham May 19, 2025
168d6e3
PR feedback
weswigham May 19, 2025
170fd3e
Rename layers as requested
weswigham May 19, 2025
9cdcd5e
Remove another dead func
weswigham May 19, 2025
20e0afd
Remove currently not require nodebuilder interface
weswigham May 20, 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
4 changes: 2 additions & 2 deletions internal/ast/utilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -1435,10 +1435,10 @@ func IsDynamicName(name *Node) bool {
}

func IsEntityNameExpression(node *Node) bool {
return node.Kind == KindIdentifier || isPropertyAccessEntityNameExpression(node)
return node.Kind == KindIdentifier || IsPropertyAccessEntityNameExpression(node)
}

func isPropertyAccessEntityNameExpression(node *Node) bool {
func IsPropertyAccessEntityNameExpression(node *Node) bool {
if node.Kind == KindPropertyAccessExpression {
expr := node.AsPropertyAccessExpression()
return expr.Name().Kind == KindIdentifier && IsEntityNameExpression(expr.Expression)
Expand Down
9 changes: 6 additions & 3 deletions internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -821,6 +821,7 @@ type Checker struct {
markNodeAssignments func(*ast.Node) bool
emitResolver *emitResolver
emitResolverOnce sync.Once
nodeBuilder NodeBuilderInterface
_jsxNamespace string
_jsxFactoryEntity *ast.Node
}
Expand Down Expand Up @@ -1027,6 +1028,8 @@ func NewChecker(program Program) *Checker {
c.getGlobalClassAccessorDecoratorTargetType = c.getGlobalTypeResolver("ClassAccessorDecoratorTarget", 2 /*arity*/, true /*reportErrors*/)
c.getGlobalClassAccessorDecoratorResultType = c.getGlobalTypeResolver("ClassAccessorDecoratorResult", 2 /*arity*/, true /*reportErrors*/)
c.getGlobalClassFieldDecoratorContextType = c.getGlobalTypeResolver("ClassFieldDecoratorContext", 2 /*arity*/, true /*reportErrors*/)
diagnosticConstructionContext := printer.NewEmitContext()
c.nodeBuilder = NewNodeBuilderAPI(c, diagnosticConstructionContext)
c.initializeClosures()
c.initializeIterationResolvers()
c.initializeChecker()
Expand Down Expand Up @@ -17923,7 +17926,7 @@ func (c *Checker) areAllOuterTypeParametersApplied(t *Type) bool {
}

func (c *Checker) reportCircularBaseType(node *ast.Node, t *Type) {
c.error(node, diagnostics.Type_0_recursively_references_itself_as_a_base_type, c.typeToStringEx(t, nil, TypeFormatFlagsWriteArrayAsGenericType))
c.error(node, diagnostics.Type_0_recursively_references_itself_as_a_base_type, c.typeToStringEx(t, nil, TypeFormatFlagsWriteArrayAsGenericType, nil))
}

// A valid base type is `any`, an object type or intersection of object types.
Expand Down Expand Up @@ -20196,11 +20199,11 @@ func (c *Checker) elaborateNeverIntersection(chain *ast.Diagnostic, node *ast.No
if t.flags&TypeFlagsIntersection != 0 && t.objectFlags&ObjectFlagsIsNeverIntersection != 0 {
neverProp := core.Find(c.getPropertiesOfUnionOrIntersectionType(t), c.isDiscriminantWithNeverType)
if neverProp != nil {
return NewDiagnosticChainForNode(chain, node, diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, c.typeToStringEx(t, nil, TypeFormatFlagsNoTypeReduction), c.symbolToString(neverProp))
return NewDiagnosticChainForNode(chain, node, diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_has_conflicting_types_in_some_constituents, c.typeToStringEx(t, nil, TypeFormatFlagsNoTypeReduction, nil), c.symbolToString(neverProp))
}
privateProp := core.Find(c.getPropertiesOfUnionOrIntersectionType(t), isConflictingPrivateProperty)
if privateProp != nil {
return NewDiagnosticChainForNode(chain, node, diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, c.typeToStringEx(t, nil, TypeFormatFlagsNoTypeReduction), c.symbolToString(privateProp))
return NewDiagnosticChainForNode(chain, node, diagnostics.The_intersection_0_was_reduced_to_never_because_property_1_exists_in_multiple_constituents_and_is_private_in_some, c.typeToStringEx(t, nil, TypeFormatFlagsNoTypeReduction, nil), c.symbolToString(privateProp))
}
}
return chain
Expand Down
Loading
Loading