Changes in src/InitTweak/FixInit.cc [680620d:08da53d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
r680620d r08da53d 367 367 ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg ); 368 368 ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() ); 369 Expression * untyped = exprStmt->get_expr(); 369 Expression * resolved = exprStmt->expr; 370 exprStmt->expr = nullptr; // take ownership of expr 370 371 371 372 // resolve copy constructor 372 373 // should only be one alternative for copy ctor and dtor expressions, since all arguments are fixed 373 374 // (VariableExpr and already resolved expression) 374 CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << untyped << std::endl; )375 Expression * resolved = ResolvExpr::findVoidExpression( untyped, indexer );375 CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << resolved << std::endl; ) 376 ResolvExpr::findVoidExpression( resolved, indexer ); 376 377 assert( resolved ); 377 378 if ( resolved->get_env() ) { … … 381 382 resolved->set_env( nullptr ); 382 383 } // if 383 384 384 delete stmt; 385 385 return resolved; … … 1112 1112 } 1113 1113 1114 DeclarationWithType * MutatingResolver::mutate( ObjectDecl * objectDecl ) {1114 DeclarationWithType * MutatingResolver::mutate( ObjectDecl * objectDecl ) { 1115 1115 // add object to the indexer assumes that there will be no name collisions 1116 1116 // in generated code. If this changes, add mutate methods for entities with … … 1120 1120 } 1121 1121 1122 Expression* MutatingResolver::mutate( UntypedExpr *untypedExpr ) { 1123 return strict_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) ); 1122 Expression * MutatingResolver::mutate( UntypedExpr * untypedExpr ) { 1123 Expression * newExpr = untypedExpr; 1124 ResolvExpr::findVoidExpression( newExpr, indexer ); 1125 return newExpr; 1124 1126 } 1125 1127 … … 1146 1148 1147 1149 // resolve assignment and dispose of new env 1148 Expression * resolvedAssign = ResolvExpr::findVoidExpression( assign, indexer ); 1149 delete resolvedAssign->env; 1150 resolvedAssign->env = nullptr; 1151 delete assign; 1150 ResolvExpr::findVoidExpression( assign, indexer ); 1151 delete assign->env; 1152 assign->env = nullptr; 1152 1153 1153 1154 // for constructor expr: … … 1158 1159 // T & tmp; 1159 1160 // &tmp = &x, ?{}(tmp), tmp 1160 CommaExpr * commaExpr = new CommaExpr( resolvedAssign, new CommaExpr( callExpr, new VariableExpr( tmp ) ) );1161 CommaExpr * commaExpr = new CommaExpr( assign, new CommaExpr( callExpr, new VariableExpr( tmp ) ) ); 1161 1162 commaExpr->set_env( env ); 1162 1163 return commaExpr;
Note: See TracChangeset
for help on using the changeset viewer.