Skip to content

Commit ee429ef

Browse files
committed
use state
1 parent 4da2e5e commit ee429ef

File tree

4 files changed

+3
-6
lines changed

4 files changed

+3
-6
lines changed

lib/typescriptServices.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2929,7 +2929,6 @@ declare namespace ts {
29292929
getTokenText(): string;
29302930
getTokenValue(): string;
29312931
hasExtendedUnicodeEscape(): boolean;
2932-
hasPrecedingDot(): boolean;
29332932
hasPrecedingLineBreak(): boolean;
29342933
isIdentifier(): boolean;
29352934
isReservedWord(): boolean;

src/compiler/scanner.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace ts {
2222
getTokenText(): string;
2323
getTokenValue(): string;
2424
hasExtendedUnicodeEscape(): boolean;
25-
hasPrecedingDot(): boolean;
2625
hasPrecedingLineBreak(): boolean;
2726
isIdentifier(): boolean;
2827
isReservedWord(): boolean;
@@ -834,7 +833,6 @@ namespace ts {
834833
getTokenText: () => text.substring(tokenPos, pos),
835834
getTokenValue: () => tokenValue,
836835
hasExtendedUnicodeEscape: () => (tokenFlags & TokenFlags.ExtendedUnicodeEscape) !== 0,
837-
hasPrecedingDot: () => (tokenFlags & TokenFlags.PrecedingDot) !== 0,
838836
hasPrecedingLineBreak: () => (tokenFlags & TokenFlags.PrecedingLineBreak) !== 0,
839837
isIdentifier: () => token === SyntaxKind.Identifier || token > SyntaxKind.LastReservedWord,
840838
isReservedWord: () => token >= SyntaxKind.FirstReservedWord && token <= SyntaxKind.LastReservedWord,
@@ -1471,7 +1469,6 @@ namespace ts {
14711469
pos++;
14721470
return token = SyntaxKind.MinusToken;
14731471
case CharacterCodes.dot:
1474-
tokenFlags |= TokenFlags.PrecedingDot;
14751472
if (isDigit(text.charCodeAt(pos + 1))) {
14761473
tokenValue = scanNumber();
14771474
return token = SyntaxKind.NumericLiteral;

src/compiler/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,6 @@ namespace ts {
15851585
BinarySpecifier = 1 << 7, // e.g. `0b0110010000000000`
15861586
OctalSpecifier = 1 << 8, // e.g. `0o777`
15871587
ContainsSeparator = 1 << 9, // e.g. `0b1100_0101`
1588-
PrecedingDot = 1 << 10,
15891588
BinaryOrOctalSpecifier = BinarySpecifier | OctalSpecifier,
15901589
NumericLiteralFlags = Scientific | Octal | HexSpecifier | BinarySpecifier | OctalSpecifier | ContainsSeparator
15911590
}

src/services/preProcess.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace ts {
1313
const importedFiles: FileReference[] = [];
1414
let ambientExternalModules: { ref: FileReference, depth: number }[];
1515
let braceNesting = 0;
16+
let lastTokenWasDot = false;
1617
// assume that text represent an external module if it contains at least one top level import/export
1718
// ambient modules that are found inside external modules are interpreted as module augmentations
1819
let externalModule = false;
@@ -25,6 +26,7 @@ namespace ts {
2526
else if (token === SyntaxKind.CloseBraceToken) {
2627
braceNesting--;
2728
}
29+
lastTokenWasDot = token === SyntaxKind.DotToken;
2830
return token;
2931
}
3032

@@ -78,7 +80,7 @@ namespace ts {
7880
*/
7981
function tryConsumeImport(): boolean {
8082
let token = scanner.getToken();
81-
if (token === SyntaxKind.ImportKeyword && !scanner.hasPrecedingDot()) {
83+
if (token === SyntaxKind.ImportKeyword && !lastTokenWasDot) {
8284
token = nextToken();
8385
if (token === SyntaxKind.OpenParenToken) {
8486
token = nextToken();

0 commit comments

Comments
 (0)