Changes in / [f20dffa:fe1b6a4]


Ignore:
Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rf20dffa rfe1b6a4  
    1010// Created On       : Sun May 17 12:17:01 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 17:23:14 2017
    13 // Update Count     : 211
     12// Last Modified On : Tue Jul 12 17:45:42 2016
     13// Update Count     : 204
    1414//
    1515
     
    371371        void Resolver::visit( SingleInit *singleInit ) {
    372372                if ( singleInit->get_value() ) {
    373                         // // find all the d's
    374                         // std::list<Expression *> &designators = singleInit->get_designators();
    375                         // std::list<Type *> types1{ initContext }, types2;
    376                         // for ( Expression * expr: designators ) {
    377                         //      cerr << expr << endl;
    378                         //      if ( NameExpr * nexpr = dynamic_cast<NameExpr *>( expr ) ) {
    379                         //              for ( Type * type: types1 ) {
    380                         //                      cerr << type << endl;
    381                         //                      ReferenceToType * fred = dynamic_cast<ReferenceToType *>(type);
    382                         //                      std::list<Declaration *> members;
    383                         //                      if ( fred ) {
    384                         //                              fred->lookup( nexpr->get_name(), members ); // concatenate identical field name
    385                         //                              for ( Declaration * mem: members ) {
    386                         //                                      if ( DeclarationWithType * dwt = dynamic_cast<DeclarationWithType *>(mem) ) {
    387                         //                                              types2.push_back( dwt->get_type() );
    388                         //                                      } // if
    389                         //                              } // for
    390                         //                      } // if
    391                         //              } // for
    392                         //              types1 = types2;
    393                         //              types2.clear();
    394                         //      } // if
    395                         // } // for
    396                         // // for ( Type * type: types1 ) {
    397                         // //   cerr << type << endl;
    398                         // // } // for
    399                        
    400                         // // O(N^2) checks of d-types with f-types
    401                         // // find the minimum cost
     373#if 0
     374                        if (NameExpr * ne = dynamic_cast<NameExpr*>(singleInit->get_value())) {
     375                                string n = ne->get_name();
     376                                if (n == "0") {
     377                                        initContext = new BasicType(Type::Qualifiers(),
     378                                                                                                BasicType::SignedInt);
     379                                } else {
     380                                        DeclarationWithType * decl = lookupId( n );
     381                                        initContext = decl->get_type();
     382                                }
     383                        } else if (ConstantExpr * e =
     384                                           dynamic_cast<ConstantExpr*>(singleInit->get_value())) {
     385                                Constant *c = e->get_constant();
     386                                initContext = c->get_type();
     387                        } else {
     388                                assert(0);
     389                        }
     390#endif
    402391                        CastExpr *castExpr = new CastExpr( singleInit->get_value(), initContext->clone() );
    403392                        Expression *newExpr = findSingleExpression( castExpr, *this );
     
    421410                        }
    422411                } // if
     412//      singleInit->get_value()->accept( *this );
    423413        }
    424414
  • src/SynTree/Initializer.h

    rf20dffa rfe1b6a4  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 16:12:42 2017
    13 // Update Count     : 20
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Tue Apr 12 13:49:13 2016
     13// Update Count     : 19
    1414//
    1515
     
    7070        void set_value( Expression *newValue ) { value = newValue; }
    7171
     72        void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }
    7273        std::list<Expression *> &get_designators() { return designators; }
    73         void set_designators( std::list<Expression *> &newValue ) { designators = newValue; }
    7474
    7575        virtual SingleInit *clone() const { return new SingleInit( *this); }
  • src/SynTree/Type.h

    rf20dffa rfe1b6a4  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Mar 23 16:16:36 2017
    13 // Update Count     : 149
     12// Last Modified On : Fri Mar 17 09:04:03 2017
     13// Update Count     : 147
    1414//
    1515
     
    331331        virtual Type *acceptMutator( Mutator & m ) = 0;
    332332        virtual void print( std::ostream & os, int indent = 0 ) const;
    333 
    334         virtual void lookup( const std::string & name, std::list< Declaration* > & foundDecls ) const {}
    335333  protected:
    336334        virtual std::string typeString() const = 0;
Note: See TracChangeset for help on using the changeset viewer.