Ignore:
Timestamp:
Dec 5, 2017, 2:35:03 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
f9feab8
Parents:
9c35431 (diff), 65197c2 (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.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r9c35431 rc13e8dc8  
    717717}
    718718
    719 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body ) {
     719DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, StatementNode * with ) {
    720720        assert( type );
    721721        assert( type->kind == TypeData::Function );
    722722        assert( ! type->function.body );
     723        if ( with ) {
     724                // convert
     725                //  void f(S s) with (s) { x = 0; }
     726                // to
     727                //  void f(S s) { with(s) { x = 0; } }
     728                WithStmt * withStmt = strict_dynamic_cast< WithStmt * >( with->build() );
     729                withStmt->stmt = body->build();
     730                delete body;
     731                delete with;
     732                body = new StatementNode( new CompoundStmt( { withStmt } ) );
     733        }
    723734        type->function.body = body;
    724735        return this;
Note: See TracChangeset for help on using the changeset viewer.