summaryrefslogtreecommitdiff
path: root/src/tools/wasm-ctor-eval.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/wasm-ctor-eval.cpp')
-rw-r--r--src/tools/wasm-ctor-eval.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/tools/wasm-ctor-eval.cpp b/src/tools/wasm-ctor-eval.cpp
index 9aa41c04d..d476bb2cc 100644
--- a/src/tools/wasm-ctor-eval.cpp
+++ b/src/tools/wasm-ctor-eval.cpp
@@ -838,8 +838,9 @@ public:
// GC data (structs and arrays) must be handled with the special global-
// creating logic later down. But MVP types as well as i31s (even
// externalized i31s) can be handled by the general makeConstantExpression
- // logic (which knows how to handle externalization, for i31s).
- if (!value.isData()) {
+ // logic (which knows how to handle externalization, for i31s; and it also
+ // can handle string constants).
+ if (!value.isData() || value.type.getHeapType().isString()) {
return builder.makeConstantExpression(original);
}
@@ -889,12 +890,6 @@ public:
} else if (heapType.isArray()) {
// TODO: for repeated identical values, can use ArrayNew
init = builder.makeArrayNewFixed(heapType, args);
- } else if (heapType.isString()) {
- std::string s;
- for (auto c : values) {
- s += char(c.getInteger());
- }
- init = builder.makeStringConst(s);
} else {
WASM_UNREACHABLE("bad gc type");
}