[wasm] Document what StringLiteral is

This commit is contained in:
Alex Beregszaszi
2020-11-20 21:16:56 +00:00
parent 3a3303f24e
commit f76ac0a753
3 changed files with 6 additions and 2 deletions
+2
View File
@@ -101,6 +101,8 @@ string TextTransform::operator()(wasm::Literal const& _literal)
string TextTransform::operator()(wasm::StringLiteral const& _literal)
{
// StringLiteral is a special AST element used for certain builtins.
// The output of this will not be valid WebAssembly.
string quoted = boost::replace_all_copy(_literal.value, "\\", "\\\\");
boost::replace_all(quoted, "\"", "\\\"");
return "\"" + quoted + "\"";