From cd63fb7d39491f917cf65c77d33f465de2e2dbda Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 25 Jun 2023 13:24:26 +0100 Subject: Write globals to symbol table --- .../wasm/structure/WasmBinaryFormatModuleTests.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java index 78054d23..58c39b85 100644 --- a/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java +++ b/src/test/java/org/shedlang/compiler/backends/wasm/structure/WasmBinaryFormatModuleTests.java @@ -164,18 +164,18 @@ public class WasmBinaryFormatModuleTests { .addImport(new WasmImport( "ModuleName1", "EntityName1", - new WasmImportDescriptor.Global(new WasmGlobalType( - WasmValueType.I32, - WasmMutability.MUTABLE - )) + new WasmImportDescriptor.Global( + "Global1", + new WasmGlobalType(WasmValueType.I32, WasmMutability.MUTABLE) + ) )) .addImport(new WasmImport( "ModuleName2", "EntityName2", - new WasmImportDescriptor.Global(new WasmGlobalType( - WasmValueType.I64, - WasmMutability.IMMUTABLE - )) + new WasmImportDescriptor.Global( + "Global2", + new WasmGlobalType(WasmValueType.I64, WasmMutability.IMMUTABLE) + ) )); var result = serializeModule(module); @@ -216,10 +216,12 @@ public class WasmBinaryFormatModuleTests { public void canSerializeModuleWithGlobals(Snapshotter snapshotter) throws IOException, InterruptedException { var module = WasmModule.EMPTY .addGlobal(new WasmGlobal( + "Global1", new WasmGlobalType(WasmValueType.I32, WasmMutability.MUTABLE), new WasmExpression(List.of(new WasmI32Const(7))) )) .addGlobal(new WasmGlobal( + "Global2", new WasmGlobalType(WasmValueType.I64, WasmMutability.IMMUTABLE), new WasmExpression(List.of(new WasmI64Const(9))) )); -- cgit v1.2.3