From 9c5df069cc466d904c8faa1888095e84ae74d404 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Wed, 14 Oct 2020 21:10:26 -0500 Subject: Assign import names consistently between text and binaryn reader (#3238) The s-parser was assigning numbers names per-type where as the binaryn reader was using the global import count as the number to append. This change switches to use per-element count which I think it preferable as it increases the stability of the auto-generated names. e.g. memory is now always named `$mimport0`. --- src/wasm/wasm-s-parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm/wasm-s-parser.cpp') diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index 462d440d8..d3367d3f6 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -2366,9 +2366,9 @@ void SExpressionWasmBuilder::parseImport(Element& s) { name = Name("gimport$" + std::to_string(globalCounter++)); globalNames.push_back(name); } else if (kind == ExternalKind::Memory) { - name = Name("mimport$" + std::to_string(0)); + name = Name("mimport$" + std::to_string(memoryCounter++)); } else if (kind == ExternalKind::Table) { - name = Name("timport$" + std::to_string(0)); + name = Name("timport$" + std::to_string(tableCounter++)); } else if (kind == ExternalKind::Event) { name = Name("eimport$" + std::to_string(eventCounter++)); eventNames.push_back(name); -- cgit v1.2.3