Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r1a5ad8c r7c3f3be  
    168168                deleteAll( indices );
    169169                indices.clear();
    170         }
    171 
    172         bool InitExpander::addReference() {
    173                 bool added = false;
    174                 for ( Expression *& expr : cur ) {
    175                         expr = new AddressExpr( expr );
    176                         added = true;
    177                 }
    178                 return added;
    179170        }
    180171
     
    279270        }
    280271
    281         Type * getTypeofThis( FunctionType * ftype ) {
    282                 assertf( ftype, "getTypeofThis: nullptr ftype" );
    283                 ObjectDecl * thisParam = getParamThis( ftype );
     272        Type * getThisType( FunctionType * ftype ) {
     273                assertf( ftype, "getThisType: nullptr ftype" );
     274                ObjectDecl * thisParam = getThisParam( ftype );
    284275                ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( thisParam->type );
    285276                return refType->base;
    286277        }
    287278
    288         ObjectDecl * getParamThis( FunctionType * ftype ) {
    289                 assertf( ftype, "getParamThis: nullptr ftype" );
     279        ObjectDecl * getThisParam( FunctionType * ftype ) {
     280                assertf( ftype, "getThisParam: nullptr ftype" );
    290281                auto & params = ftype->parameters;
    291                 assertf( ! params.empty(), "getParamThis: ftype with 0 parameters: %s", toString( ftype ).c_str() );
     282                assertf( ! params.empty(), "getThisParam: ftype with 0 parameters: %s", toString( ftype ).c_str() );
    292283                return strict_dynamic_cast< ObjectDecl * >( params.front() );
    293284        }
     
    362353                        assert( expr );
    363354                        if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) {
    364                                 return varExpr->var;
     355                                return varExpr->get_var();
    365356                        } else if ( MemberExpr * memberExpr = dynamic_cast< MemberExpr * >( expr ) ) {
    366                                 return memberExpr->member;
     357                                return memberExpr->get_member();
    367358                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    368                                 return getCalledFunction( castExpr->arg );
     359                                return getCalledFunction( castExpr->get_arg() );
    369360                        } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) {
    370361                                return handleDerefCalledFunction( untypedExpr );
     
    372363                                return handleDerefCalledFunction( appExpr );
    373364                        } else if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( expr ) ) {
    374                                 return getCalledFunction( addrExpr->arg );
    375                         } else if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( expr ) ) {
    376                                 return getCalledFunction( commaExpr->arg2 );
     365                                return getCalledFunction( addrExpr->get_arg() );
    377366                        }
    378367                        return nullptr;
     
    589578        FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname ) {
    590579                FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl );
    591                 if ( ! function ) return nullptr;
    592                 if ( function->name != fname ) return nullptr;
    593                 FunctionType * ftype = function->type;
    594                 if ( ftype->parameters.size() != 2 ) return nullptr;
     580                if ( ! function ) return 0;
     581                if ( function->get_name() != fname ) return 0;
     582                FunctionType * ftype = function->get_functionType();
     583                if ( ftype->get_parameters().size() != 2 ) return 0;
    595584
    596585                Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
    597                 Type * t2 = ftype->parameters.back()->get_type();
     586                Type * t2 = ftype->get_parameters().back()->get_type();
    598587                assert( t1 );
    599588
     
    615604        }
    616605        FunctionDecl * isDefaultConstructor( Declaration * decl ) {
    617                 if ( isConstructor( decl->name ) ) {
     606                if ( isConstructor( decl->get_name() ) ) {
    618607                        if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) {
    619                                 if ( func->type->parameters.size() == 1 ) {
     608                                if ( func->get_functionType()->get_parameters().size() == 1 ) {
    620609                                        return func;
    621610                                }
Note: See TracChangeset for help on using the changeset viewer.