Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Validate/ImplementEnumFunc.cpp

    r19313be5 raf746cc  
    156156                                         const ast::ObjectDecl* dstParam,
    157157                                         const ast::ObjectDecl* srcParam) {
     158        // const CodeLocation& location = func->location;
     159        // auto& params = func->params;
     160        // assert(2 == params.size());
     161        // auto dstParam = params.front().strict_as<ast::ObjectDecl>();
     162        // auto srcParam = params.back().strict_as<ast::ObjectDecl>();
    158163        return new ast::CompoundStmt(
    159164            location,
     
    296301        {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))},
    297302        {new ast::ObjectDecl(getLocation(), "_ret",
    298             new ast::BasicType(ast::BasicKind::UnsignedInt))});
     303                             new ast::EnumAttrType(new ast::EnumInstType(decl),
     304                                                   ast::EnumAttribute::Posn))});
    299305}
    300306
     
    305311        {new ast::ObjectDecl(
    306312            getLocation(), "_ret",
    307             new ast::PointerType(new ast::BasicType{ast::BasicKind::Char}))});
     313            new ast::PointerType(new ast::BasicType{ast::BasicType::Char}))});
    308314}
    309315
     
    358364        attr == ast::EnumAttribute::Value
    359365            ? decl->base
    360             : new ast::PointerType(new ast::BasicType{ast::BasicKind::Char}),
     366            : new ast::PointerType(new ast::BasicType{ast::BasicType::Char}),
    361367        ast::ConstantExpr::from_int(decl->location, decl->members.size()),
    362368        ast::LengthFlag::FixedLen, ast::DimensionFlag::DynamicDim);
     
    434440
    435441    auto addOneExpr = ast::UntypedExpr::createCall( location,
    436         succ? "?+?": "?-?",
     442        "?+?",
    437443        {new ast::VariableExpr(location, param),
    438444        ast::ConstantExpr::from_int(location, 1)}
     
    510516    ast::EnumInstType enumInst(enumDecl->name);
    511517    enumInst.base = enumDecl;
    512 
     518    // ast::EnumAttrType attr = ast::EnumAttrType(&enumInst);
     519    // EnumAttrFuncGenerator gen(enumDecl, &enumInst functionNesting);
    513520    EnumAttrFuncGenerator gen(enumDecl, &enumInst, functionNesting);
    514521    gen.generateAndAppendFunctions(declsToAddAfter);
Note: See TracChangeset for help on using the changeset viewer.