summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-s-parser.cpp
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2022-07-06 08:48:12 -0700
committerGitHub <noreply@github.com>2022-07-06 08:48:12 -0700
commit876638f8fb5bfc8b264eddc6c0c0d54ed40d0095 (patch)
tree40138beab484617d5b3af474f8e1bd485ffc603e /src/wasm/wasm-s-parser.cpp
parentb69d3a8fa0d6d7588811ef92067a48eed576e03f (diff)
downloadbinaryen-876638f8fb5bfc8b264eddc6c0c0d54ed40d0095.tar.gz
binaryen-876638f8fb5bfc8b264eddc6c0c0d54ed40d0095.tar.bz2
binaryen-876638f8fb5bfc8b264eddc6c0c0d54ed40d0095.zip
[Strings] Add string.const (#4768)
This is more work than a typical instruction because it also adds a new section: all the (string.const "foo") strings are put in a new "strings" section in the binary, and the instructions refer to them by index.
Diffstat (limited to 'src/wasm/wasm-s-parser.cpp')
-rw-r--r--src/wasm/wasm-s-parser.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp
index ac15c5e68..cd6c167c0 100644
--- a/src/wasm/wasm-s-parser.cpp
+++ b/src/wasm/wasm-s-parser.cpp
@@ -2953,6 +2953,10 @@ Expression* SExpressionWasmBuilder::makeStringNew(Element& s, StringNewOp op) {
op, parseExpression(s[i]), parseExpression(s[i + 1]));
}
+Expression* SExpressionWasmBuilder::makeStringConst(Element& s) {
+ return Builder(wasm).makeStringConst(s[1]->str());
+}
+
// converts an s-expression string representing binary data into an output
// sequence of raw bytes this appends to data, which may already contain
// content.