Skip to content

Commit

Permalink
use GeneratorContext::get_qualified_module() more
Browse files Browse the repository at this point in the history
  • Loading branch information
dwrensha committed Apr 21, 2023
1 parent 3b19644 commit f720c47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion capnpc/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl<'a> GeneratorContext<'a> {
Ok(())
}

fn get_qualified_module(&self, type_id: u64) -> String {
pub fn get_qualified_module(&self, type_id: u64) -> String {
self.scope_map[&type_id].join("::")
}
}
Expand Down
9 changes: 3 additions & 6 deletions capnpc/src/codegen_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ impl<'a> RustTypeInfo for type_::Reader<'a> {
st.get_type_id(),
st.get_brand()?,
module,
&gen.scope_map[&st.get_type_id()].join("::"),
&gen.get_qualified_module(st.get_type_id()),
None,
),
type_::Interface(interface) => do_branding(
gen,
interface.get_type_id(),
interface.get_brand()?,
module,
&gen.scope_map[&interface.get_type_id()].join("::"),
&gen.get_qualified_module(interface.get_type_id()),
None,
),
type_::List(ot1) => {
Expand Down Expand Up @@ -260,10 +260,7 @@ impl<'a> RustTypeInfo for type_::Reader<'a> {
}
}
}
type_::Enum(en) => {
let scope = &gen.scope_map[&en.get_type_id()];
Ok(scope.join("::"))
}
type_::Enum(en) => Ok(gen.get_qualified_module(en.get_type_id())),
type_::AnyPointer(pointer) => match pointer.which()? {
type_::any_pointer::Parameter(def) => {
let the_struct = &gen.node_map[&def.get_scope_id()];
Expand Down

0 comments on commit f720c47

Please sign in to comment.