mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Use our own scanner for 'isNumericName'.
This commit is contained in:
@@ -4092,8 +4092,14 @@ module ts {
|
||||
return createArrayType(elementType);
|
||||
}
|
||||
|
||||
var numericScanner: Scanner;
|
||||
function isNumericName(name: string) {
|
||||
return !isNaN(<number><any>name);
|
||||
numericScanner = numericScanner || createScanner(compilerOptions.target || ScriptTarget.ES5, /*skipTrivia*/ false);
|
||||
numericScanner.setText(name);
|
||||
|
||||
// Ensure that the name is nothing more than a numeric literal
|
||||
// (i.e. it is preceded by nothing (whitespace) and scanning leaves us at the very end of the string).
|
||||
return numericScanner.scan() === SyntaxKind.NumericLiteral && numericScanner.getTextPos() === name.length;
|
||||
}
|
||||
|
||||
function checkObjectLiteral(node: ObjectLiteral, contextualMapper?: TypeMapper): Type {
|
||||
|
||||
Reference in New Issue
Block a user