@@ -14,7 +14,7 @@ import (
14
14
"github.com/microsoft/typescript-go/internal/printer"
15
15
)
16
16
17
- var _ printer.EmitResolver = & emitResolver {}
17
+ var _ printer.EmitResolver = ( * emitResolver )( nil )
18
18
19
19
// Links for jsx
20
20
type JSXLinks struct {
@@ -35,12 +35,20 @@ type emitResolver struct {
35
35
checker * Checker
36
36
checkerMu sync.Mutex
37
37
isValueAliasDeclaration func (node * ast.Node ) bool
38
+ aliasMarkingVisitor func (node * ast.Node ) bool
38
39
referenceResolver binder.ReferenceResolver
39
40
jsxLinks core.LinkStore [* ast.Node , JSXLinks ]
40
41
declarationLinks core.LinkStore [* ast.Node , DeclarationLinks ]
41
42
declarationFileLinks core.LinkStore [* ast.Node , DeclarationFileLinks ]
42
43
}
43
44
45
+ func newEmitResolver (checker * Checker ) * emitResolver {
46
+ e := & emitResolver {checker : checker }
47
+ e .isValueAliasDeclaration = e .isValueAliasDeclarationWorker
48
+ e .aliasMarkingVisitor = e .aliasMarkingVisitorWorker
49
+ return e
50
+ }
51
+
44
52
func (r * emitResolver ) GetJsxFactoryEntity (location * ast.Node ) * ast.Node {
45
53
r .checkerMu .Lock ()
46
54
defer r .checkerMu .Unlock ()
@@ -227,7 +235,7 @@ func (r *emitResolver) PrecalculateDeclarationEmitVisibility(file *ast.SourceFil
227
235
file .AsNode ().ForEachChild (r .aliasMarkingVisitor )
228
236
}
229
237
230
- func (r * emitResolver ) aliasMarkingVisitor (node * ast.Node ) bool {
238
+ func (r * emitResolver ) aliasMarkingVisitorWorker (node * ast.Node ) bool {
231
239
switch node .Kind {
232
240
case ast .KindExportAssignment , ast .KindJSExportAssignment :
233
241
if node .AsExportAssignment ().Expression .Kind == ast .KindIdentifier {
@@ -670,9 +678,6 @@ func (r *emitResolver) isValueAliasDeclarationWorker(node *ast.Node) bool {
670
678
return symbol != nil && r .isAliasResolvedToValue (symbol , true /*excludeTypeOnlyValues*/ )
671
679
case ast .KindExportDeclaration :
672
680
exportClause := node .AsExportDeclaration ().ExportClause
673
- if r .isValueAliasDeclaration == nil {
674
- r .isValueAliasDeclaration = r .isValueAliasDeclarationWorker
675
- }
676
681
return exportClause != nil && (ast .IsNamespaceExport (exportClause ) ||
677
682
core .Some (exportClause .AsNamedExports ().Elements .Nodes , r .isValueAliasDeclaration ))
678
683
case ast .KindExportAssignment , ast .KindJSExportAssignment :
0 commit comments