Changeset c453ac4 for src/Parser
- Timestamp:
- Jan 31, 2018, 4:55:49 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:
- 7aaec67
- Parents:
- c28a038d
- Location:
- src/Parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
rc28a038d rc453ac4 723 723 } 724 724 725 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, StatementNode * with) {725 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, ExpressionNode * withExprs ) { 726 726 assert( type ); 727 727 assert( type->kind == TypeData::Function ); 728 728 assert( ! type->function.body ); 729 if ( with ) {730 // convert731 // void f(S s) with (s) { x = 0; }732 // to733 // void f(S s) { with(s) { x = 0; } }734 WithStmt * withStmt = strict_dynamic_cast< WithStmt * >( with->build() );735 withStmt->stmt = body->build();736 delete body;737 delete with;738 body = new StatementNode( new CompoundStmt( { withStmt } ) );739 }740 729 type->function.body = body; 730 type->function.withExprs = withExprs; 741 731 return this; 742 732 } -
src/Parser/ParseNode.h
rc28a038d rc453ac4 262 262 DeclarationNode * addBitfield( ExpressionNode * size ); 263 263 DeclarationNode * addVarArgs(); 264 DeclarationNode * addFunctionBody( StatementNode * body, StatementNode * with = nullptr );264 DeclarationNode * addFunctionBody( StatementNode * body, ExpressionNode * with = nullptr ); 265 265 DeclarationNode * addOldDeclList( DeclarationNode * list ); 266 266 DeclarationNode * setBase( TypeData * newType ); -
src/Parser/TypeData.cc
rc28a038d rc453ac4 864 864 CompoundStmt * body = dynamic_cast< CompoundStmt * >( stmt ); 865 865 decl = new FunctionDecl( name, scs, linkage, buildFunction( td ), body, attributes, funcSpec ); 866 buildList( td->function.withExprs, decl->withExprs ); 866 867 return decl->set_asmName( asmName ); 867 868 } else if ( td->kind == TypeData::Aggregate ) { -
src/Parser/parser.yy
rc28a038d rc453ac4 259 259 %type<sn> iteration_statement jump_statement 260 260 %type<sn> expression_statement asm_statement 261 %type<sn> with_statement with_clause_opt 261 %type<sn> with_statement 262 %type<en> with_clause_opt 262 263 %type<sn> exception_statement handler_clause finally_clause 263 264 %type<catch_kind> handler_key … … 2417 2418 { $$ = nullptr; } 2418 2419 | WITH '(' tuple_expression_list ')' 2419 { $$ = new StatementNode( build_with( $3, nullptr ) ); }2420 { $$ = $3; } 2420 2421 ; 2421 2422
Note: See TracChangeset
for help on using the changeset viewer.