Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    rc453ac4 r71d0eab  
    723723}
    724724
    725 DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, ExpressionNode * withExprs ) {
     725DeclarationNode * DeclarationNode::addFunctionBody( StatementNode * body, StatementNode * with ) {
    726726        assert( type );
    727727        assert( type->kind == TypeData::Function );
    728728        assert( ! type->function.body );
     729        if ( with ) {
     730                // convert
     731                //  void f(S s) with (s) { x = 0; }
     732                // to
     733                //  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        }
    729740        type->function.body = body;
    730         type->function.withExprs = withExprs;
    731741        return this;
    732742}
Note: See TracChangeset for help on using the changeset viewer.