summaryrefslogtreecommitdiff
path: root/src/wasm-builder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-builder.h')
-rw-r--r--src/wasm-builder.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/wasm-builder.h b/src/wasm-builder.h
index 324ed6fd2..5592273da 100644
--- a/src/wasm-builder.h
+++ b/src/wasm-builder.h
@@ -1153,6 +1153,14 @@ public:
if (type.isRef() && type.getHeapType() == HeapType::i31) {
return makeI31New(makeConst(value.geti31()));
}
+ if (type.isString()) {
+ // TODO: more than ascii support
+ std::string string;
+ for (auto c : value.getGCData()->values) {
+ string.push_back(c.getInteger());
+ }
+ return makeStringConst(string);
+ }
TODO_SINGLE_COMPOUND(type);
WASM_UNREACHABLE("unsupported constant expression");
}