@@ -49,9 +49,8 @@ func (e *emitter) emit() {
49
49
e .emitBuildInfo (e .paths .BuildInfoPath ())
50
50
}
51
51
52
- func (e * emitter ) getDeclarationTransformers (emitContext * printer.EmitContext , sourceFile * ast.SourceFile , declarationFilePath string , declarationMapPath string ) []* declarations.DeclarationTransformer {
53
- emitResolver := e .host .GetEmitResolver (sourceFile , false /*skipDiagnostics*/ ) // !!! conditionally skip diagnostics
54
- transform := declarations .NewDeclarationTransformer (e .host , emitResolver , emitContext , e .host .Options (), declarationFilePath , declarationMapPath )
52
+ func (e * emitter ) getDeclarationTransformers (emitContext * printer.EmitContext , declarationFilePath string , declarationMapPath string ) []* declarations.DeclarationTransformer {
53
+ transform := declarations .NewDeclarationTransformer (e .host , emitContext , e .host .Options (), declarationFilePath , declarationMapPath )
55
54
return []* declarations.DeclarationTransformer {transform }
56
55
}
57
56
@@ -86,7 +85,7 @@ func getScriptTransformers(emitContext *printer.EmitContext, host printer.EmitHo
86
85
var emitResolver printer.EmitResolver
87
86
var referenceResolver binder.ReferenceResolver
88
87
if importElisionEnabled || options .GetJSXTransformEnabled () {
89
- emitResolver = host .GetEmitResolver (sourceFile , false /*skipDiagnostics*/ ) // !!! conditionally skip diagnostics
88
+ emitResolver = host .GetEmitResolver ()
90
89
emitResolver .MarkLinkedReferencesRecursively (sourceFile )
91
90
referenceResolver = emitResolver
92
91
} else {
@@ -179,7 +178,7 @@ func (e *emitter) emitDeclarationFile(sourceFile *ast.SourceFile, declarationFil
179
178
var diags []* ast.Diagnostic
180
179
emitContext , putEmitContext := printer .GetEmitContext ()
181
180
defer putEmitContext ()
182
- for _ , transformer := range e .getDeclarationTransformers (emitContext , sourceFile , declarationFilePath , declarationMapPath ) {
181
+ for _ , transformer := range e .getDeclarationTransformers (emitContext , declarationFilePath , declarationMapPath ) {
183
182
sourceFile = transformer .TransformSourceFile (sourceFile )
184
183
diags = append (diags , transformer .GetDiagnostics ()... )
185
184
}
@@ -378,6 +377,7 @@ type SourceFileMayBeEmittedHost interface {
378
377
IsSourceFileFromExternalLibrary (file * ast.SourceFile ) bool
379
378
GetCurrentDirectory () string
380
379
UseCaseSensitiveFileNames () bool
380
+ SourceFiles () []* ast.SourceFile
381
381
}
382
382
383
383
func sourceFileMayBeEmitted (sourceFile * ast.SourceFile , host SourceFileMayBeEmittedHost , forceDtsEmit bool ) bool {
@@ -435,7 +435,7 @@ func sourceFileMayBeEmitted(sourceFile *ast.SourceFile, host SourceFileMayBeEmit
435
435
return true
436
436
}
437
437
438
- func getSourceFilesToEmit (host printer. EmitHost , targetSourceFile * ast.SourceFile , forceDtsEmit bool ) []* ast.SourceFile {
438
+ func getSourceFilesToEmit (host SourceFileMayBeEmittedHost , targetSourceFile * ast.SourceFile , forceDtsEmit bool ) []* ast.SourceFile {
439
439
// !!! outFile not yet implemented, may be deprecated
440
440
var sourceFiles []* ast.SourceFile
441
441
if targetSourceFile != nil {
@@ -452,13 +452,13 @@ func isSourceFileNotJson(file *ast.SourceFile) bool {
452
452
return ! ast .IsJsonSourceFile (file )
453
453
}
454
454
455
- func getDeclarationDiagnostics (host EmitHost , resolver printer. EmitResolver , file * ast.SourceFile ) []* ast.Diagnostic {
455
+ func getDeclarationDiagnostics (host EmitHost , file * ast.SourceFile ) []* ast.Diagnostic {
456
456
fullFiles := core .Filter (getSourceFilesToEmit (host , file , false ), isSourceFileNotJson )
457
457
if ! core .Some (fullFiles , func (f * ast.SourceFile ) bool { return f == file }) {
458
458
return []* ast.Diagnostic {}
459
459
}
460
460
options := host .Options ()
461
- transform := declarations .NewDeclarationTransformer (host , resolver , nil , options , "" , "" )
461
+ transform := declarations .NewDeclarationTransformer (host , nil , options , "" , "" )
462
462
transform .TransformSourceFile (file )
463
463
return transform .GetDiagnostics ()
464
464
}
0 commit comments