diff options
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r-- | src/wasm/wasm.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp index 64bc5615f..4e4186d08 100644 --- a/src/wasm/wasm.cpp +++ b/src/wasm/wasm.cpp @@ -198,7 +198,7 @@ const char* getExpressionName(Expression* curr) { WASM_UNREACHABLE("invalid expr id"); } -Literal getLiteralFromConstExpression(Expression* curr) { +Literal getSingleLiteralFromConstExpression(Expression* curr) { if (auto* c = curr->dynCast<Const>()) { return c->value; } else if (curr->is<RefNull>()) { @@ -210,6 +210,18 @@ Literal getLiteralFromConstExpression(Expression* curr) { } } +Literals getLiteralsFromConstExpression(Expression* curr) { + if (auto* t = curr->dynCast<TupleMake>()) { + Literals values; + for (auto* operand : t->operands) { + values.push_back(getSingleLiteralFromConstExpression(operand)); + } + return values; + } else { + return {getSingleLiteralFromConstExpression(curr)}; + } +} + // core AST type checking struct TypeSeeker : public PostWalker<TypeSeeker> { |