Skip to content

Commit

Permalink
Merge pull request #85 from talex5/fix-unknown-iface-error
Browse files Browse the repository at this point in the history
Fix "Unknown interface" error
  • Loading branch information
talex5 authored Aug 6, 2022
2 parents d867af8 + 346b9f7 commit 7acfd0a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/genModules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ let generate_service ~context ~nested_modules ~node_name ~interface_node interfa
[ "class virtual service = object (self)";
" method release = ()";
" method dispatch ~interface_id:i ~method_id =";
" if i <> interface_id then MessageWrapper.Untyped.unknown_interface ~interface_id";
" if i <> interface_id then MessageWrapper.Untyped.unknown_interface ~interface_id:i";
" else match method_id with";
] @ apply_indent ~indent:" " dispatch_body @
[ " | x -> MessageWrapper.Untyped.unknown_method ~interface_id ~method_id";
Expand Down
7 changes: 7 additions & 0 deletions src/runtime/rPC.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module Registry : sig
It prints out qualified names, suitable for logging
(e.g. "Foo.bar") *)
val pp_method : Format.formatter -> Uint64.t * int -> unit

val pp_interface : Format.formatter -> Uint64.t -> unit
end = struct
type interface = {
name : string;
Expand All @@ -34,6 +36,11 @@ end = struct
Format.fprintf f "%s.%s" interface.name method_name
| None ->
Format.fprintf f "%s.<method-%d>" interface.name method_id

let pp_interface f interface_id =
match Hashtbl.find interfaces interface_id with
| exception Not_found -> Format.fprintf f "<interface %a>" Uint64.printer interface_id
| interface -> Format.fprintf f "%s" interface.name
end

module MethodID : sig
Expand Down

0 comments on commit 7acfd0a

Please sign in to comment.