@@ -13,14 +13,12 @@ namespace ts {
13
13
const importedFiles : FileReference [ ] = [ ] ;
14
14
let ambientExternalModules : { ref : FileReference , depth : number } [ ] ;
15
15
let braceNesting = 0 ;
16
- let lastToken : SyntaxKind ;
17
16
// assume that text represent an external module if it contains at least one top level import/export
18
17
// ambient modules that are found inside external modules are interpreted as module augmentations
19
18
let externalModule = false ;
20
19
21
20
function nextToken ( ) {
22
21
const token = scanner . scan ( ) ;
23
- lastToken = token ;
24
22
if ( token === SyntaxKind . OpenBraceToken ) {
25
23
braceNesting ++ ;
26
24
}
@@ -79,9 +77,8 @@ namespace ts {
79
77
* Returns true if at least one token was consumed from the stream
80
78
*/
81
79
function tryConsumeImport ( ) : boolean {
82
- const lastTokenWasDot = lastToken === SyntaxKind . DotToken ;
83
80
let token = scanner . getToken ( ) ;
84
- if ( token === SyntaxKind . ImportKeyword && ! lastTokenWasDot ) {
81
+ if ( token === SyntaxKind . ImportKeyword ) {
85
82
token = nextToken ( ) ;
86
83
if ( token === SyntaxKind . OpenParenToken ) {
87
84
token = nextToken ( ) ;
@@ -300,9 +297,14 @@ namespace ts {
300
297
// AnySymbol.import("mod")
301
298
302
299
while ( true ) {
303
- if ( scanner . getToken ( ) === SyntaxKind . EndOfFileToken ) {
300
+ const token = scanner . getToken ( ) ;
301
+ if ( token === SyntaxKind . EndOfFileToken ) {
304
302
break ;
305
303
}
304
+ if ( token === SyntaxKind . DotToken ) {
305
+ nextToken ( ) ; // jump over anything directly following the dot
306
+ nextToken ( ) ;
307
+ }
306
308
307
309
// check if at least one of alternative have moved scanner forward
308
310
if ( tryConsumeDeclare ( ) ||
0 commit comments