Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/wasm/wasm-ir-builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,9 @@ Result<> IRBuilder::makeThrowRef() {
}

Result<> IRBuilder::makeTupleMake(uint32_t arity) {
if (arity < 2) {
return Err{"tuple arity must be at least 2"};
}
TupleMake curr(wasm.allocator);
curr.operands.resize(arity);
CHECK_ERR(visitTupleMake(&curr));
Expand All @@ -1553,13 +1556,22 @@ Result<> IRBuilder::makeTupleMake(uint32_t arity) {
}

Result<> IRBuilder::makeTupleExtract(uint32_t arity, uint32_t index) {
if (index >= arity) {
return Err{"tuple index out of bounds"};
}
if (arity < 2) {
return Err{"tuple arity must be at least 2"};
}
TupleExtract curr;
CHECK_ERR(visitTupleExtract(&curr, arity));
push(builder.makeTupleExtract(curr.tuple, index));
return Ok{};
}

Result<> IRBuilder::makeTupleDrop(uint32_t arity) {
if (arity < 2) {
return Err{"tuple arity must be at least 2"};
}
Drop curr;
CHECK_ERR(visitDrop(&curr, arity));
push(builder.makeDrop(curr.value));
Expand Down