added code printing
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 9 Jul 2021 18:59:41 +0000 (13:59 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Fri, 9 Jul 2021 18:59:41 +0000 (13:59 -0500)
src/test_console.onyx

index 3b0a60b7078b1c9b44a9f53e965b4d9b290cb155..a3d668189178204ec3e7359b60341a48b0ce0324 100644 (file)
@@ -17,9 +17,18 @@ main :: (args: [] cstr) {
 
     wasm_sections := wasm.parse_sections(^wasm_binary, context.allocator);
     defer wasm.free_sections(^wasm_sections);
-    printf("Types:\n{p}\n", wasm_sections.type_section);
-    printf("Imports:\n{p}\n", wasm_sections.import_section);
-    printf("Exports:\n{p}\n", wasm_sections.export_section);
+
+    i := 0;
+    for ^code: wasm_sections.code_section {
+        i += 1;
+        printf("Function {}\n", i);
+        for instr: wasm.instruction_iterator(^wasm_binary, code) {
+            printf("{}\n", instr);
+        }
+        print("\n");
+    }
+
+
     // printf("Code:\n{}\n", wasm_sections.code_section);
 
     // type_section := wasm.parse_type_section(^wasm_binary);