- Timestamp:
- Jan 11, 2017, 3:29:33 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- d3a85240
- Parents:
- 627f585
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r627f585 rdd0c97b 136 136 template< typename DeclClass > 137 137 DeclClass *handleDecl( DeclClass *decl, Type *type ); 138 139 using PolyMutator::mutate; 138 template< typename AggDecl > 139 AggDecl * handleAggDecl( AggDecl * aggDecl ); 140 141 typedef PolyMutator Parent; 142 using Parent::mutate; 140 143 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 141 144 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 145 virtual StructDecl *mutate( StructDecl *structDecl ) override; 146 virtual UnionDecl *mutate( UnionDecl *unionDecl ) override; 142 147 virtual TypeDecl *mutate( TypeDecl *typeDecl ) override; 143 148 virtual TypedefDecl *mutate( TypedefDecl *typedefDecl ) override; … … 1275 1280 template< typename DeclClass > 1276 1281 DeclClass * Pass2::handleDecl( DeclClass *decl, Type *type ) { 1277 DeclClass *ret = static_cast< DeclClass *>( Mutator::mutate( decl ) );1282 DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) ); 1278 1283 1279 1284 return ret; … … 1309 1314 } 1310 1315 1316 template< typename AggDecl > 1317 AggDecl * Pass2::handleAggDecl( AggDecl * aggDecl ) { 1318 // prevent tyVars from leaking into containing scope 1319 scopeTyVars.beginScope(); 1320 Parent::mutate( aggDecl ); 1321 scopeTyVars.endScope(); 1322 return aggDecl; 1323 } 1324 1325 StructDecl * Pass2::mutate( StructDecl *aggDecl ) { 1326 return handleAggDecl( aggDecl ); 1327 } 1328 1329 UnionDecl * Pass2::mutate( UnionDecl *aggDecl ) { 1330 return handleAggDecl( aggDecl ); 1331 } 1332 1311 1333 TypeDecl * Pass2::mutate( TypeDecl *typeDecl ) { 1312 1334 addToTyVarMap( typeDecl, scopeTyVars ); … … 1314 1336 return handleDecl( typeDecl, typeDecl->get_base() ); 1315 1337 } else { 1316 return Mutator::mutate( typeDecl );1338 return Parent::mutate( typeDecl ); 1317 1339 } 1318 1340 } … … 1326 1348 makeTyVarMap( pointerType, scopeTyVars ); 1327 1349 1328 Type *ret = Mutator::mutate( pointerType );1350 Type *ret = Parent::mutate( pointerType ); 1329 1351 1330 1352 scopeTyVars.endScope(); -
src/tests/.expect/tupleVariadic.txt
r627f585 rdd0c97b 9 9 called ?{} with a: 10 2 3 4 10 10 array = { 10, 2, 3, 4, } 11 copy=111111 11 12 calling func 12 13 called process(int) 3 -
src/tests/tupleVariadic.c
r627f585 rdd0c97b 89 89 } 90 90 91 forall(otype T) 92 T * copy(T x) { 93 // test calling new inside a polymorphic function 94 return new(x); 95 } 96 91 97 int main() { 92 98 array * x0 = new(); … … 104 110 array * x4 = new(10, 2, 3, 4); 105 111 print(x4); 112 113 int * ptr = copy(111111); 114 printf("copy=%d\n", *ptr); 115 106 116 printf("calling func\n"); 107 117 func(3, 2.0, 111, 4.145);
Note: See TracChangeset
for help on using the changeset viewer.