File tree Expand file tree Collapse file tree 9 files changed +65
-3
lines changed 
tests/typescript/types/keywords Expand file tree Collapse file tree 9 files changed +65
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ edition = "2018"
77license  = " Apache-2.0/MIT" 
88name  = " swc_atoms" 
99repository  = " https://github.com/swc-project/swc.git" 
10- version  = " 0.2.4 " 
10+ version  = " 0.2.5 " 
1111
1212[dependencies ]
1313string_cache  = " 0.8" 
Original file line number Diff line number Diff line change 620620infer
621621instanceof
622622interface
623+ intrinsic
623624is
624625iterator
625626key
Original file line number Diff line number Diff line change @@ -382,6 +382,9 @@ pub enum TsKeywordTypeKind {
382382
383383    #[ serde( rename = "never" ) ]  
384384    TsNeverKeyword , 
385+ 
386+     #[ serde( rename = "intrinsic" ) ]  
387+     TsIntrinsicKeyword , 
385388} 
386389
387390#[ ast_node( "TsThisType" ) ]  
Original file line number Diff line number Diff line change @@ -347,6 +347,7 @@ impl<'a> Emitter<'a> {
347347            TsKeywordTypeKind :: TsUndefinedKeyword  => keyword ! ( n. span,  "undefined" ) , 
348348            TsKeywordTypeKind :: TsNullKeyword  => keyword ! ( n. span,  "null" ) , 
349349            TsKeywordTypeKind :: TsNeverKeyword  => keyword ! ( n. span,  "never" ) , 
350+             TsKeywordTypeKind :: TsIntrinsicKeyword  => keyword ! ( n. span,  "intrinsic" ) , 
350351        } 
351352    } 
352353
Original file line number Diff line number Diff line change @@ -323,6 +323,9 @@ macro_rules! tok {
323323    ( "bigint" )  => { 
324324        crate :: token:: Token :: Word ( crate :: token:: Word :: Ident ( swc_atoms:: js_word!( "bigint" ) ) ) 
325325    } ; 
326+     ( "intrinsic" )  => { 
327+         crate :: token:: Token :: Word ( crate :: token:: Word :: Ident ( swc_atoms:: js_word!( "intrinsic" ) ) ) 
328+     } ; 
326329    ( "never" )  => { 
327330        crate :: token:: Token :: Word ( crate :: token:: Word :: Ident ( swc_atoms:: js_word!( "never" ) ) ) 
328331    } ; 
Original file line number Diff line number Diff line change @@ -881,7 +881,8 @@ impl<I: Tokens> Parser<I> {
881881            | js_word ! ( "bigint" ) 
882882            | js_word ! ( "symbol" ) 
883883            | js_word ! ( "void" ) 
884-             | js_word ! ( "never" )  => { 
884+             | js_word ! ( "never" ) 
885+             | js_word ! ( "intrinsic" )  => { 
885886                self . emit_err ( id. span ,  SyntaxError :: TS2427 ) ; 
886887            } 
887888            _ => { } 
@@ -1773,6 +1774,8 @@ impl<I: Tokens> Parser<I> {
17731774                    Some ( TsKeywordTypeKind :: TsUnknownKeyword ) 
17741775                }  else  if  is ! ( "undefined" )  { 
17751776                    Some ( TsKeywordTypeKind :: TsUndefinedKeyword ) 
1777+                 }  else  if  is ! ( "intrinsic" )  { 
1778+                     Some ( TsKeywordTypeKind :: TsIntrinsicKeyword ) 
17761779                }  else  { 
17771780                    None 
17781781                } ; 
Original file line number Diff line number Diff line change @@ -10,3 +10,4 @@ let sy: symbol;
1010let  u : undefined ; 
1111let  v : void ; 
1212let  n : bigint ; 
13+ let  i : intrinsic ; 
Original file line number Diff line number Diff line change 22  "type" : " Script" 
33  "span" : {
44    "start" : 0 ,
5-     "end" : 184 ,
5+     "end" : 202 ,
66    "ctxt" : 0 
77  },
88  "body" : [
593593          "definite" : false 
594594        }
595595      ]
596+     },
597+     {
598+       "type" : " VariableDeclaration" 
599+       "span" : {
600+         "start" : 185 ,
601+         "end" : 202 ,
602+         "ctxt" : 0 
603+       },
604+       "kind" : " let" 
605+       "declare" : false ,
606+       "declarations" : [
607+         {
608+           "type" : " VariableDeclarator" 
609+           "span" : {
610+             "start" : 189 ,
611+             "end" : 201 ,
612+             "ctxt" : 0 
613+           },
614+           "id" : {
615+             "type" : " Identifier" 
616+             "span" : {
617+               "start" : 189 ,
618+               "end" : 190 ,
619+               "ctxt" : 0 
620+             },
621+             "value" : " i" 
622+             "typeAnnotation" : {
623+               "type" : " TsTypeAnnotation" 
624+               "span" : {
625+                 "start" : 190 ,
626+                 "end" : 201 ,
627+                 "ctxt" : 0 
628+               },
629+               "typeAnnotation" : {
630+                 "type" : " TsKeywordType" 
631+                 "span" : {
632+                   "start" : 192 ,
633+                   "end" : 201 ,
634+                   "ctxt" : 0 
635+                 },
636+                 "kind" : " intrinsic" 
637+               }
638+             },
639+             "optional" : false 
640+           },
641+           "init" : null ,
642+           "definite" : false 
643+         }
644+       ]
596645    }
597646  ],
598647  "interpreter" : null 
Original file line number Diff line number Diff line change @@ -1394,6 +1394,7 @@ define!({
13941394        TsUndefinedKeyword , 
13951395        TsNullKeyword , 
13961396        TsNeverKeyword , 
1397+         TsIntrinsicKeyword , 
13971398    } 
13981399    pub  struct  TsThisType  { 
13991400        pub  span:  Span , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments