Helper: build a Component with an imported component func (func index 0).
| 1099 | |
| 1100 | // Helper: build a Component with an imported component func (func index 0). |
| 1101 | inline AST::Component::Component makeCompWithImportedFunc() { |
| 1102 | AST::Component::Component Comp; |
| 1103 | // Need a FuncType at type index 0. |
| 1104 | Comp.getSections().emplace_back(); |
| 1105 | Comp.getSections().back().emplace<AST::Component::TypeSection>(); |
| 1106 | auto &TypeSec = |
| 1107 | std::get<AST::Component::TypeSection>(Comp.getSections().back()); |
| 1108 | TypeSec.getContent().emplace_back(); |
| 1109 | TypeSec.getContent().back().setFuncType(AST::Component::FuncType()); |
| 1110 | // Import a func of that type. |
| 1111 | Comp.getSections().emplace_back(); |
| 1112 | Comp.getSections().back().emplace<AST::Component::ImportSection>(); |
| 1113 | auto &ImpSec = |
| 1114 | std::get<AST::Component::ImportSection>(Comp.getSections().back()); |
| 1115 | ImpSec.getContent().emplace_back(); |
| 1116 | ImpSec.getContent().back().getName() = "f"; |
| 1117 | ImpSec.getContent().back().getDesc().setFuncTypeIdx(0); |
| 1118 | return Comp; |
| 1119 | } |
| 1120 | |
| 1121 | // Helper: build a Component with a resource (type 0), a FuncType (type 1), |
| 1122 | // and a core func allocated via resource.new 0 (core func index 0). |
no test coverage detected