Changes in src/InitTweak/InitTweak.cc [1a5ad8c:7c3f3be]
- File:
-
- 1 edited
-
src/InitTweak/InitTweak.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r1a5ad8c r7c3f3be 168 168 deleteAll( indices ); 169 169 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;179 170 } 180 171 … … 279 270 } 280 271 281 Type * getT ypeofThis( FunctionType * ftype ) {282 assertf( ftype, "getT ypeofThis: nullptr ftype" );283 ObjectDecl * thisParam = get ParamThis( ftype );272 Type * getThisType( FunctionType * ftype ) { 273 assertf( ftype, "getThisType: nullptr ftype" ); 274 ObjectDecl * thisParam = getThisParam( ftype ); 284 275 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( thisParam->type ); 285 276 return refType->base; 286 277 } 287 278 288 ObjectDecl * get ParamThis( FunctionType * ftype ) {289 assertf( ftype, "get ParamThis: nullptr ftype" );279 ObjectDecl * getThisParam( FunctionType * ftype ) { 280 assertf( ftype, "getThisParam: nullptr ftype" ); 290 281 auto & params = ftype->parameters; 291 assertf( ! params.empty(), "get ParamThis: ftype with 0 parameters: %s", toString( ftype ).c_str() );282 assertf( ! params.empty(), "getThisParam: ftype with 0 parameters: %s", toString( ftype ).c_str() ); 292 283 return strict_dynamic_cast< ObjectDecl * >( params.front() ); 293 284 } … … 362 353 assert( expr ); 363 354 if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) { 364 return varExpr-> var;355 return varExpr->get_var(); 365 356 } else if ( MemberExpr * memberExpr = dynamic_cast< MemberExpr * >( expr ) ) { 366 return memberExpr-> member;357 return memberExpr->get_member(); 367 358 } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) { 368 return getCalledFunction( castExpr-> arg);359 return getCalledFunction( castExpr->get_arg() ); 369 360 } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) { 370 361 return handleDerefCalledFunction( untypedExpr ); … … 372 363 return handleDerefCalledFunction( appExpr ); 373 364 } 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() ); 377 366 } 378 367 return nullptr; … … 589 578 FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname ) { 590 579 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; 595 584 596 585 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(); 598 587 assert( t1 ); 599 588 … … 615 604 } 616 605 FunctionDecl * isDefaultConstructor( Declaration * decl ) { 617 if ( isConstructor( decl-> name) ) {606 if ( isConstructor( decl->get_name() ) ) { 618 607 if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) { 619 if ( func-> type->parameters.size() == 1 ) {608 if ( func->get_functionType()->get_parameters().size() == 1 ) { 620 609 return func; 621 610 }
Note:
See TracChangeset
for help on using the changeset viewer.