File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -264,8 +264,9 @@ class Host implements ts.CompilerHost {
264
264
const sourceFile = fetchSourceFile ( specifier , referrer ) ;
265
265
assert ( sourceFile . moduleName != null ) ;
266
266
const { moduleName } = sourceFile ;
267
- assert ( ! ( moduleName ! in this . _sourceFileCache ) ) ;
268
- this . _sourceFileCache [ moduleName ! ] = sourceFile ;
267
+ if ( ! ( moduleName ! in this . _sourceFileCache ) ) {
268
+ this . _sourceFileCache [ moduleName ! ] = sourceFile ;
269
+ }
269
270
return sourceFile ;
270
271
}
271
272
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ export function parseTypeDirectives(
49
49
return ;
50
50
}
51
51
52
+ // collect all the directives in the file and their start and end positions
52
53
const directives : DirectiveInfo [ ] = [ ] ;
53
54
let maybeMatch : RegExpExecArray | null = null ;
54
55
while ( ( maybeMatch = typeDirectiveRegEx . exec ( sourceCode ) ) ) {
@@ -64,6 +65,8 @@ export function parseTypeDirectives(
64
65
return ;
65
66
}
66
67
68
+ // work from the last directive backwards for any `import`/`export` statements
69
+ // adding their module specifiers to
67
70
directives . reverse ( ) ;
68
71
const directiveRecords : Record < string , string > = { } ;
69
72
for ( const { path, start, end } of directives ) {
You can’t perform that action at this time.
0 commit comments