Changeset bfbf97f


Ignore:
Timestamp:
Jun 10, 2015, 4:13:35 PM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
a8541d9
Parents:
b5c5684
git-author:
Rob Schluntz <rschlunt@…> (06/10/15 15:47:38)
git-committer:
Rob Schluntz <rschlunt@…> (06/10/15 16:13:35)
Message:

recursively resolve the type of array dimensions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rb5c5684 rbfbf97f  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Jun 10 15:32:16 2015
    13 // Update Count     : 45
     12// Last Modified On : Wed Jun 10 16:11:19 2015
     13// Update Count     : 77
    1414//
    1515
     
    3737                virtual void visit( ObjectDecl *functionDecl );
    3838                virtual void visit( TypeDecl *typeDecl );
     39                virtual void visit( ArrayType * at );
    3940
    4041                virtual void visit( ExprStmt *exprStmt );
     
    157158                initContext = new_type;
    158159                SymTab::Indexer::visit( objectDecl );
    159 
    160                 if ( ArrayType * at = dynamic_cast< ArrayType * >( new_type ) ){
    161                         if ( at->get_dimension() ) {
    162                                 BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    163                                 CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
    164                                 Expression *newExpr = findSingleExpression( castExpr, *this );
    165                                 delete at->get_dimension();
    166                                 at->set_dimension( newExpr );
    167                         }
    168                 }
     160        }
     161
     162        void Resolver::visit( ArrayType * at ) {
     163                if ( at->get_dimension() ) {
     164                        BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
     165                        CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
     166                        Expression *newExpr = findSingleExpression( castExpr, *this );
     167                        delete at->get_dimension();
     168                        at->set_dimension( newExpr );
     169
     170                }
     171                Visitor::visit( at );
    169172        }
    170173 
Note: See TracChangeset for help on using the changeset viewer.