File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -273,7 +273,26 @@ void TypeChecker::Visitor::operator()(VaArgExpressionAST* ast) {
273273  }
274274}
275275
276- void  TypeChecker::Visitor::operator ()(SubscriptExpressionAST* ast) {}
276+ void  TypeChecker::Visitor::operator ()(SubscriptExpressionAST* ast) {
277+   if  (auto  pointerType = type_cast<PointerType>(ast->baseExpression ->type )) {
278+     ast->type  = pointerType->elementType ();
279+     ast->valueCategory  = ast->baseExpression ->valueCategory ;
280+     return ;
281+   }
282+ 
283+   if  (auto  arrayType = type_cast<BoundedArrayType>(ast->baseExpression ->type )) {
284+     ast->type  = arrayType->elementType ();
285+     ast->valueCategory  = ast->baseExpression ->valueCategory ;
286+     return ;
287+   }
288+ 
289+   if  (auto  arrayType =
290+           type_cast<UnboundedArrayType>(ast->baseExpression ->type )) {
291+     ast->type  = arrayType->elementType ();
292+     ast->valueCategory  = ast->baseExpression ->valueCategory ;
293+     return ;
294+   }
295+ }
277296
278297void  TypeChecker::Visitor::operator ()(CallExpressionAST* ast) {
279298  if  (!ast->baseExpression ) return ;
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments