Changeset 6e49f18 for src/CodeGen
- Timestamp:
- Sep 27, 2017, 11:11:30 PM (8 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:
- f802e46
- Parents:
- a6c5d7c (diff), fa16264 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/CodeGen
- Files:
-
- 2 edited
-
CodeGenerator.cc (modified) (2 diffs)
-
CodeGenerator.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
ra6c5d7c r6e49f18 540 540 extension( nameExpr ); 541 541 OperatorInfo opInfo; 542 if ( operatorLookup( nameExpr->get_name(), opInfo ) ) { 543 assert( opInfo.type == OT_CONSTANT ); 544 output << opInfo.symbol; 542 if ( operatorLookup( nameExpr->name, opInfo ) ) { 543 if ( opInfo.type == OT_CONSTANT ) { 544 output << opInfo.symbol; 545 } else { 546 output << opInfo.outputName; 547 } 545 548 } else { 546 549 output << nameExpr->get_name(); … … 943 946 output << ";"; 944 947 } 948 void CodeGenerator::postvisit( CatchStmt * stmt ) { 949 assertf( ! genC, "Catch statements should not reach code generation." ); 950 951 output << ((stmt->get_kind() == CatchStmt::Terminate) ? 952 "catch" : "catchResume"); 953 output << "( "; 954 stmt->decl->accept( *visitor ); 955 output << " ) "; 956 957 if( stmt->cond ) { 958 output << "if/when(?) ("; 959 stmt->cond->accept( *visitor ); 960 output << ") "; 961 } 962 stmt->body->accept( *visitor ); 963 } 964 965 void CodeGenerator::postvisit( WaitForStmt * stmt ) { 966 assertf( ! genC, "Waitfor statements should not reach code generation." ); 967 968 bool first = true; 969 for( auto & clause : stmt->clauses ) { 970 if(first) { output << "or "; first = false; } 971 if( clause.condition ) { 972 output << "when("; 973 stmt->timeout.condition->accept( *visitor ); 974 output << ") "; 975 } 976 output << "waitfor("; 977 clause.target.function->accept( *visitor ); 978 for( Expression * expr : clause.target.arguments ) { 979 output << ","; 980 expr->accept( *visitor ); 981 } 982 output << ") "; 983 clause.statement->accept( *visitor ); 984 } 985 986 if( stmt->timeout.statement ) { 987 output << "or "; 988 if( stmt->timeout.condition ) { 989 output << "when("; 990 stmt->timeout.condition->accept( *visitor ); 991 output << ") "; 992 } 993 output << "timeout("; 994 stmt->timeout.time->accept( *visitor ); 995 output << ") "; 996 stmt->timeout.statement->accept( *visitor ); 997 } 998 999 if( stmt->orelse.statement ) { 1000 output << "or "; 1001 if( stmt->orelse.condition ) { 1002 output << "when("; 1003 stmt->orelse.condition->accept( *visitor ); 1004 output << ")"; 1005 } 1006 output << "else "; 1007 stmt->orelse.statement->accept( *visitor ); 1008 } 1009 } 1010 945 1011 946 1012 void CodeGenerator::postvisit( WhileStmt * whileStmt ) { -
src/CodeGen/CodeGenerator.h
ra6c5d7c r6e49f18 100 100 void postvisit( ReturnStmt * ); 101 101 void postvisit( ThrowStmt * ); 102 void postvisit( CatchStmt * ); 103 void postvisit( WaitForStmt * ); 102 104 void postvisit( WhileStmt * ); 103 105 void postvisit( ForStmt * );
Note:
See TracChangeset
for help on using the changeset viewer.