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 {
79
79
inJSXElement = false ;
80
80
}
81
81
82
- if ( isIdentifier ( node ) && ! inJSXElement && ! inImportClause ( node ) ) {
82
+ if ( isIdentifier ( node ) && ! inJSXElement && ! inImportClause ( node ) && ! isInfinityOrNaNString ( node . escapedText ) ) {
83
83
let symbol = typeChecker . getSymbolAtLocation ( node ) ;
84
84
if ( symbol ) {
85
85
if ( symbol . flags & SymbolFlags . Alias ) {
@@ -225,6 +225,10 @@ namespace ts.classifier.v2020 {
225
225
return ( isQualifiedName ( node . parent ) && node . parent . right === node ) || ( isPropertyAccessExpression ( node . parent ) && node . parent . name === node ) ;
226
226
}
227
227
228
+ function isInfinityOrNaNString ( name : __String ) : boolean {
229
+ return name === "Infinity" || name === "NaN" ;
230
+ }
231
+
228
232
const tokenFromDeclarationMapping = new Map < SyntaxKind , TokenType > ( [
229
233
[ SyntaxKind . VariableDeclaration , TokenType . variable ] ,
230
234
[ 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