File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,12 @@ export class LuaTransformer {
108108 this . setupState ( ) ;
109109
110110 this . currentSourceFile = node ;
111- this . resolver = this . checker . getEmitResolver ( node ) ;
111+
112+ // Use `getParseTreeNode` to get original SourceFile node, before it was substituted by custom transformers.
113+ // It's required because otherwise `getEmitResolver` won't use cached diagnostics, produced in `emitWorker`
114+ // and would try to re-analyze the file, which would fail because of replaced nodes.
115+ const originalSourceFile = ts . getParseTreeNode ( node , ts . isSourceFile ) || node ;
116+ this . resolver = this . checker . getEmitResolver ( originalSourceFile ) ;
112117
113118 let statements : tstl . Statement [ ] = [ ] ;
114119 if ( node . flags & ts . NodeFlags . JsonFile ) {
You can’t perform that action at this time.
0 commit comments