summaryrefslogtreecommitdiff
path: root/src/wasm/wasm.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm.cpp')
-rw-r--r--src/wasm/wasm.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/wasm/wasm.cpp b/src/wasm/wasm.cpp
index c03a9b281..c857b202c 100644
--- a/src/wasm/wasm.cpp
+++ b/src/wasm/wasm.cpp
@@ -217,18 +217,15 @@ const char* getExpressionName(Expression* curr) {
}
Literal getSingleLiteralFromConstExpression(Expression* curr) {
- if (auto* c = curr->dynCast<Const>()) {
- return c->value;
- } else if (auto* n = curr->dynCast<RefNull>()) {
- return Literal::makeNull(n->type);
- } else if (auto* r = curr->dynCast<RefFunc>()) {
- return Literal::makeFunc(r->func);
- } else {
- WASM_UNREACHABLE("Not a constant expression");
- }
+ // TODO: Do we need this function given that Properties::getSingleLiteral
+ // (currently) does the same?
+ assert(Properties::isConstantExpression(curr));
+ return Properties::getSingleLiteral(curr);
}
Literals getLiteralsFromConstExpression(Expression* curr) {
+ // TODO: Do we need this function given that Properties::getLiterals
+ // (currently) does the same?
if (auto* t = curr->dynCast<TupleMake>()) {
Literals values;
for (auto* operand : t->operands) {