Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/Autogen.cpp

    r1761046 r0522ebe  
    133133        /// Generates a single struct member operation.
    134134        /// (constructor call, destructor call, assignment call)
    135         const ast::Stmt * makeMemberOp(
     135        // This is managed because it uses another helper that returns a ast::ptr.
     136        ast::ptr<ast::Stmt> makeMemberOp(
    136137                const CodeLocation& location,
    137138                const ast::ObjectDecl * dstParam, const ast::Expr * src,
     
    205206        ast::FunctionDecl * genLabelProto() const;
    206207        ast::FunctionDecl * genValueProto() const;
     208        // ast::FunctionDecl * genValueProto2() const;
    207209};
    208210
     
    523525}
    524526
    525 const ast::Stmt * StructFuncGenerator::makeMemberOp(
     527ast::ptr<ast::Stmt> StructFuncGenerator::makeMemberOp(
    526528                const CodeLocation& location, const ast::ObjectDecl * dstParam,
    527529                const ast::Expr * src, const ast::ObjectDecl * field,
     
    538540                )
    539541        );
    540         const ast::Stmt * stmt = genImplicitCall(
     542        auto stmt = genImplicitCall(
    541543                srcParam, dstSelect, location, func->name,
    542544                field, direction
     
    596598                        location, field, new ast::VariableExpr( location, srcParam )
    597599                ) : nullptr;
    598                 const ast::Stmt * stmt =
     600                ast::ptr<ast::Stmt> stmt =
    599601                        makeMemberOp( location, dstParam, srcSelect, field, func, direction );
    600602
    601603                if ( nullptr != stmt ) {
    602                         stmts->kids.emplace_back( stmt );
     604                        stmts->kids.push_back( stmt );
    603605                }
    604606        }
     
    621623        for ( auto param = params.begin() + 1 ; current != end ; ++current ) {
    622624                const ast::ptr<ast::Decl> & member = *current;
    623                 const ast::Stmt * stmt = nullptr;
     625                ast::ptr<ast::Stmt> stmt = nullptr;
    624626                auto field = member.as<ast::ObjectDecl>();
    625627                // Not sure why it could be null.
     
    639641
    640642                if ( nullptr != stmt ) {
    641                         stmts->kids.emplace_back( stmt );
     643                        stmts->kids.push_back( stmt );
    642644                }
    643645        }
     
    789791}
    790792
     793// ast::FunctionDecl * EnumFuncGenerator::genValueProto2() const {
     794//      return genProto( "valueE",
     795//              { new ast::ObjectDecl( getLocation(), "_i", new ast::EnumPosType( new ast::EnumInstType( decl ) ) )},
     796//              { new ast::ObjectDecl( getLocation(), "_ret", ast::deepCopy( decl->base ) ) } );
     797// }
     798
    791799void EnumFuncGenerator::genAttrFuncForward() { 
    792800        if ( decl->base ) {
    793801                ast::FunctionDecl *(EnumFuncGenerator::*attrProtos[3])() const = {
    794802                        &EnumFuncGenerator::genPosProto, &EnumFuncGenerator::genLabelProto,
    795                         &EnumFuncGenerator::genValueProto };
     803                        &EnumFuncGenerator::genValueProto
     804                        // , &EnumFuncGenerator::genValueProto2
     805                        };
    796806                for ( auto & generator : attrProtos ) {
    797807                        produceForwardDecl( (this->*generator)() );
Note: See TracChangeset for help on using the changeset viewer.