Completely remove check strict mode from parser
This commit is contained in:
parent
958f7b8202
commit
fb9009f741
1 changed files with 4 additions and 14 deletions
|
@ -1350,13 +1350,8 @@ module ts {
|
||||||
return speculationHelper(callback, /*isLookAhead:*/ false);
|
return speculationHelper(callback, /*isLookAhead:*/ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function takes a flag "considerStrictModeContext" because in the case of parsing
|
// Ignore strict mode flag because we will be report an error in type checker instead.
|
||||||
// an identifier, we don't want to consider whether we are in strict mode. This is because
|
function isIdentifier(): boolean {
|
||||||
// if the identifier violates strict-mode reserved word, we want to report more explicit error
|
|
||||||
// in the checker.
|
|
||||||
// However, in some cases such as isLetDeclaration, we want to know at the parse time whether
|
|
||||||
// next token is really an identifier in strict mode and report an error.
|
|
||||||
function isIdentifier(considerStrictModeContext = true): boolean {
|
|
||||||
if (token === SyntaxKind.Identifier) {
|
if (token === SyntaxKind.Identifier) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1367,13 +1362,8 @@ module ts {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (considerStrictModeContext) {
|
|
||||||
return inStrictModeContext() ? token > SyntaxKind.LastFutureReservedWord : token > SyntaxKind.LastReservedWord;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return token > SyntaxKind.LastReservedWord;
|
return token > SyntaxKind.LastReservedWord;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage): boolean {
|
function parseExpected(kind: SyntaxKind, diagnosticMessage?: DiagnosticMessage): boolean {
|
||||||
if (token === kind) {
|
if (token === kind) {
|
||||||
|
@ -1510,7 +1500,7 @@ module ts {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier {
|
function parseIdentifier(diagnosticMessage?: DiagnosticMessage): Identifier {
|
||||||
return createIdentifier(isIdentifier(/*considerStrictModeContext*/ false), diagnosticMessage);
|
return createIdentifier(isIdentifier(), diagnosticMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseIdentifierName(): Identifier {
|
function parseIdentifierName(): Identifier {
|
||||||
|
|
Loading…
Reference in a new issue