Skip to content

Commit

Permalink
Collect known types from proc-macro exported enums and records
Browse files Browse the repository at this point in the history
  • Loading branch information
jplatte committed Apr 6, 2023
1 parent 744e308 commit 9fe221c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions uniffi_bindgen/src/interface/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ impl ComponentInterface {
pub(super) fn add_enum_definition(&mut self, defn: Enum) -> Result<()> {
match self.enums.entry(defn.name().to_owned()) {
Entry::Vacant(v) => {
for variant in defn.variants() {
for field in variant.fields() {
self.types.add_known_type(field.type_())?;
}
}
v.insert(defn);
}
Entry::Occupied(o) => {
Expand All @@ -561,6 +566,9 @@ impl ComponentInterface {
pub(super) fn add_record_definition(&mut self, defn: Record) -> Result<()> {
match self.records.entry(defn.name().to_owned()) {
Entry::Vacant(v) => {
for field in defn.fields() {
self.types.add_known_type(field.type_())?;
}
v.insert(defn);
}
Entry::Occupied(o) => {
Expand Down

0 comments on commit 9fe221c

Please sign in to comment.