File tree Expand file tree Collapse file tree 2 files changed +44
-1
lines changed
Expand file tree Collapse file tree 2 files changed +44
-1
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ namespace ts.classifier.v2020 {
7979 inJSXElement = false ;
8080 }
8181
82- if ( isIdentifier ( node ) && ! inJSXElement && ! inImportClause ( node ) ) {
82+ if ( isIdentifier ( node ) && ! inJSXElement && ! inImportClause ( node ) && ! isInfinityOrNaNString ( node . escapedText ) ) {
8383 let symbol = typeChecker . getSymbolAtLocation ( node ) ;
8484 if ( symbol ) {
8585 if ( symbol . flags & SymbolFlags . Alias ) {
@@ -225,6 +225,10 @@ namespace ts.classifier.v2020 {
225225 return ( isQualifiedName ( node . parent ) && node . parent . right === node ) || ( isPropertyAccessExpression ( node . parent ) && node . parent . name === node ) ;
226226 }
227227
228+ function isInfinityOrNaNString ( name : __String ) : boolean {
229+ return name === "Infinity" || name === "NaN" ;
230+ }
231+
228232 const tokenFromDeclarationMapping = new Map < SyntaxKind , TokenType > ( [
229233 [ SyntaxKind . VariableDeclaration , TokenType . variable ] ,
230234 [ SyntaxKind . Parameter , TokenType . parameter ] ,
Original file line number Diff line number Diff line change 1+ /// <reference path="fourslash.ts"/>
2+
3+ //// Infinity;
4+ //// NaN;
5+ ////
6+ ////// Regular properties
7+ ////
8+ ////const obj1 = {
9+ //// Infinity: 100,
10+ //// NaN: 200,
11+ //// "-Infinity": 300
12+ //// };
13+ ////
14+ ////obj1.Infinity;
15+ ////obj1.NaN;
16+ ////obj1["-Infinity"];
17+ ////
18+ ////// Shorthand properties
19+ ////
20+ ////const obj2 = {
21+ //// Infinity,
22+ //// NaN,
23+ //// }
24+ ////
25+ ////obj2.Infinity;
26+ ////obj2.NaN;
27+
28+ // Basically only the obj1 and obj2 should be showing up in this list
29+
30+ const c2 = classification ( "2020" ) ;
31+ verify . semanticClassificationsAre ( "2020" ,
32+ c2 . semanticToken ( "variable.declaration.readonly" , "obj1" ) ,
33+ c2 . semanticToken ( "variable.readonly" , "obj1" ) ,
34+ c2 . semanticToken ( "variable.readonly" , "obj1" ) ,
35+ c2 . semanticToken ( "variable.readonly" , "obj1" ) ,
36+ c2 . semanticToken ( "variable.declaration.readonly" , "obj2" ) ,
37+ c2 . semanticToken ( "variable.readonly" , "obj2" ) ,
38+ c2 . semanticToken ( "variable.readonly" , "obj2" ) ,
39+ ) ;
You can’t perform that action at this time.
0 commit comments