Changeset 236f133 for src/Validate
- Timestamp:
- Jul 11, 2024, 3:04:34 PM (6 months ago)
- Branches:
- master
- Children:
- 9c447e2
- Parents:
- 9d5eacb
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Validate/ImplementEnumFunc.cpp
r9d5eacb r236f133 25 25 : decl(decl), 26 26 functionNesting{functionNesting}, 27 quasi_void_decl(new ast::StructDecl(decl->location,28 "quasi_void", ast::AggregateDecl::Struct,29 {}, ast::Linkage::AutoGen)),27 // quasi_void_decl(new ast::StructDecl(decl->location, 28 // "quasi_void", ast::AggregateDecl::Struct, 29 // {}, ast::Linkage::AutoGen)), 30 30 proto_linkage{ast::Linkage::Cforall} {} 31 31 … … 208 208 209 209 ast::FunctionDecl* EnumAttrFuncGenerator::genValueProto() const { 210 if (decl->isTyped()) 211 return genProto( 212 "value", 213 {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))}, 214 {new ast::ObjectDecl(getLocation(), "_ret", 215 ast::deepCopy(decl->base))}); 216 else 217 return genQuasiValueProto(); 218 } 219 220 ast::FunctionDecl* EnumAttrFuncGenerator::genQuasiValueProto() const { 210 assert (decl->isTyped()); 221 211 return genProto( 222 212 "value", 223 213 {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))}, 224 214 {new ast::ObjectDecl(getLocation(), "_ret", 225 new ast::StructInstType(quasi_void_decl))}); 226 } 215 ast::deepCopy(decl->base))}); 216 // else 217 // return genQuasiValueProto(); 218 } 219 220 // ast::FunctionDecl* EnumAttrFuncGenerator::genQuasiValueProto() const { 221 // return genProto( 222 // "value", 223 // {new ast::ObjectDecl(getLocation(), "_i", new ast::EnumInstType(decl))}, 224 // {new ast::ObjectDecl(getLocation(), "_ret", 225 // new ast::StructInstType(quasi_void_decl))}); 226 // } 227 227 228 228 ast::FunctionDecl* EnumAttrFuncGenerator::genFromIntProto() const { … … 390 390 } 391 391 392 void EnumAttrFuncGenerator::genQuasiValueBody(ast::FunctionDecl* func) const {393 auto location = func->location;394 const ast::ObjectDecl * objDecl = new ast::ObjectDecl(395 location, "_out", new ast::StructInstType( quasi_void_decl ));396 const ast::DeclStmt * declStmt = new ast::DeclStmt(location, objDecl);397 const ast::VariableExpr * varExpr = new ast::VariableExpr(location, objDecl);398 const ast::ReturnStmt * retStmt = new ast::ReturnStmt(location, varExpr);399 400 func->stmts = new ast::CompoundStmt(401 location, {declStmt, retStmt}402 );403 }392 // void EnumAttrFuncGenerator::genQuasiValueBody(ast::FunctionDecl* func) const { 393 // auto location = func->location; 394 // const ast::ObjectDecl * objDecl = new ast::ObjectDecl( 395 // location, "_out", new ast::StructInstType( quasi_void_decl )); 396 // const ast::DeclStmt * declStmt = new ast::DeclStmt(location, objDecl); 397 // const ast::VariableExpr * varExpr = new ast::VariableExpr(location, objDecl); 398 // const ast::ReturnStmt * retStmt = new ast::ReturnStmt(location, varExpr); 399 400 // func->stmts = new ast::CompoundStmt( 401 // location, {declStmt, retStmt} 402 // ); 403 // } 404 404 405 405 void EnumAttrFuncGenerator::genPosnBody(ast::FunctionDecl* func) const { … … 433 433 genValueOrLabelBody(funcProto, arrayProto); 434 434 produceDecl(funcProto); 435 } else { 436 ast::FunctionDecl* funcProto = genQuasiValueProto(); 437 produceForwardDecl(funcProto); 438 genQuasiValueBody(funcProto); 439 produceDecl(funcProto); 440 } 435 } 436 // else { 437 // ast::FunctionDecl* funcProto = genQuasiValueProto(); 438 // produceForwardDecl(funcProto); 439 // // genQuasiValueBody(funcProto); 440 // produceDecl(funcProto); 441 // } 441 442 } else if (attr == ast::EnumAttribute::Label) { 442 443 std::vector<ast::ptr<ast::Init>> inits = genLabelInit();
Note: See TracChangeset
for help on using the changeset viewer.