diff options
author | Thomas Lively <tlively@google.com> | 2024-02-06 14:05:27 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-06 14:05:27 -0800 |
commit | 3a41065a27fc4e65d563ae983a06cbe774ad2ea7 (patch) | |
tree | bf66bf0c28465a96d97076505efca306db3db429 /src/wasm | |
parent | 8cce4d103a2ee54e7f09e81fc25b982b060d0e41 (diff) | |
download | binaryen-3a41065a27fc4e65d563ae983a06cbe774ad2ea7.tar.gz binaryen-3a41065a27fc4e65d563ae983a06cbe774ad2ea7.tar.bz2 binaryen-3a41065a27fc4e65d563ae983a06cbe774ad2ea7.zip |
Properly stringify names in tests (#6279)
Update identifiers used in tests to use a format supported by the new text
parser, i.e. either the standard format with its limited set of allowed
characters or the non-standard `$"..."` format. Notably, any name containing
square or curly braces now uses the string format.
Input automatically updated with this script:
https://gist.github.com/tlively/4e22311736661849e641d02e521a0748
The printer is updated to properly escape names in more places as well. The
logic for escaping names is moved to a common location so that the type
printing logic in wasm-type.cpp can use it as well.
Diffstat (limited to 'src/wasm')
-rw-r--r-- | src/wasm/wasm-type.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index f1ceca51a..31042835c 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -1788,7 +1788,7 @@ void TypePrinter::printHeapTypeName(HeapType type) { print(type); return; } - os << '$' << generator(type).name; + generator(type).name.print(os); #if TRACE_CANONICALIZATION os << "(;" << ((type.getID() >> 4) % 1000) << ";) "; #endif @@ -1915,7 +1915,8 @@ std::ostream& TypePrinter::print(HeapType type) { auto names = generator(type); - os << "(type $" << names.name << ' '; + os << "(type "; + names.name.print(os) << ' '; if (isTemp(type)) { os << "(; temp ;) "; @@ -2018,7 +2019,7 @@ TypePrinter::print(const Struct& struct_, // TODO: move this to the function for printing fields. os << " (field "; if (auto it = fieldNames.find(i); it != fieldNames.end()) { - os << '$' << it->second << ' '; + it->second.print(os) << ' '; } print(struct_.fields[i]); os << ')'; |