File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,13 @@ extension Parser.Lookahead {
274274    var  lookahead  =  self . lookahead ( ) 
275275    lookahead. eat ( . leftBrace) 
276276
277+     // '@_accessorBlock' is a builtin disambiguation marker.
278+     if  lookahead. peek ( isAt:  . identifier) , 
279+       lookahead. peek ( ) . tokenText ==  " _accessorBlock " 
280+     { 
281+       return  true 
282+     } 
283+ 
277284    // Eat attributes, if present.
278285    while  lookahead. consume ( if:  . atSign)  !=  nil  { 
279286      guard  lookahead. consume ( if:  . identifier)  !=  nil  else  { 
Original file line number Diff line number Diff line change @@ -3768,4 +3768,41 @@ final class UsingDeclarationTests: ParserTestCase {
37683768       """ 
37693769    ) 
37703770  } 
3771+ 
3772+   func  testAccessorBlockDisambiguationMarker( )  { 
3773+     assertParse ( 
3774+       """ 
3775+       var value = initialValue { @_accessorBlock 
3776+         get 
3777+       } 
3778+        """ , 
3779+       substructure:  VariableDeclSyntax ( 
3780+         bindingSpecifier:  . keyword( . var) , 
3781+         bindings:  [ 
3782+           PatternBindingSyntax ( 
3783+             pattern:  IdentifierPatternSyntax ( identifier:  . identifier( " value " ) ) , 
3784+             initializer:  InitializerClauseSyntax ( 
3785+               value:  DeclReferenceExprSyntax ( baseName:  . identifier( " initialValue " ) ) 
3786+             ) , 
3787+             accessorBlock:  AccessorBlockSyntax ( 
3788+               leftBrace:  . leftBraceToken( ) , 
3789+               accessors:  . accessors( [ 
3790+                 AccessorDeclSyntax ( 
3791+                   attributes:  [ 
3792+                     . attribute( 
3793+                       AttributeSyntax ( 
3794+                         atSign:  . atSignToken( ) , 
3795+                         attributeName:  IdentifierTypeSyntax ( name:  . identifier( " _accessorBlock " ) ) 
3796+                       ) 
3797+                     ) 
3798+                   ] , 
3799+                   accessorSpecifier:  . keyword( . get) 
3800+                 ) 
3801+               ] ) 
3802+             ) 
3803+           ) 
3804+         ] 
3805+       ) 
3806+     ) 
3807+   } 
37713808} 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments