Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/passes/PrintBoundary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,19 +135,20 @@ struct PrintBoundary : public Pass {
switch (kind) {
case ExternalKind::Function:
return getTypes(wasm.getFunction(name)->type);
break;
case ExternalKind::Table:
break;
return getTypes(wasm.getTable(name)->type);
case ExternalKind::Memory:
break;
return getTypes(wasm.getMemory(name)->addressType);
case ExternalKind::Global:
return getTypes(wasm.getGlobal(name)->type);
case ExternalKind::Tag:
break;
// Wrap it in a Type so that getTypes can handle it. That will print the
// params and results as we expect.
return getTypes(Type(wasm.getTag(name)->type, NonNullable));
case ExternalKind::Invalid:
WASM_UNREACHABLE("invalid ExternalKind");
break;
}
return {};
WASM_UNREACHABLE("invalid ExternalKind");
}

json::Value::Ref getKindName(ExternalKind kind) {
Expand Down
34 changes: 34 additions & 0 deletions test/lit/passes/print-boundary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@

(import "module2" "other" (func $bar (result i32 f32)))

(memory $mem 10 20)

(table 10 20 funcref)

(tag $e (param i32))

(global $g (mut i32) (i32.const 42))

(export "one" (func $one))

(export "m" (memory $mem))

(export "tab" (table 0))

(export "tag" (tag $e))

(export "glob" (global $g))

(func $one (param $x (ref $struct)) (result i32 i32 i32)
Expand Down Expand Up @@ -64,9 +76,31 @@
;; CHECK-NEXT: }
;; CHECK-NEXT: },
;; CHECK-NEXT: {
;; CHECK-NEXT: "name": "m",
;; CHECK-NEXT: "kind": "memory",
;; CHECK-NEXT: "type": "i32"
;; CHECK-NEXT: },
;; CHECK-NEXT: {
;; CHECK-NEXT: "name": "tab",
;; CHECK-NEXT: "kind": "table",
;; CHECK-NEXT: "type": "funcref"
;; CHECK-NEXT: },
;; CHECK-NEXT: {
;; CHECK-NEXT: "name": "tag",
;; CHECK-NEXT: "kind": "tag",
;; CHECK-NEXT: "type": {
;; CHECK-NEXT: "params": [
;; CHECK-NEXT: "i32"
;; CHECK-NEXT: ],
;; CHECK-NEXT: "results": [
;; CHECK-NEXT: ]
;; CHECK-NEXT: }
;; CHECK-NEXT: },
;; CHECK-NEXT: {
;; CHECK-NEXT: "name": "glob",
;; CHECK-NEXT: "kind": "global",
;; CHECK-NEXT: "type": "i32"
;; CHECK-NEXT: }
;; CHECK-NEXT: ]
;; CHECK-NEXT: }

Loading