Skip to content

Commit

Permalink
bugfix(spec-gen): iterate all modules for a given item type before co…
Browse files Browse the repository at this point in the history
…ntinuing to next item type
  • Loading branch information
ralexstokes committed Apr 8, 2024
1 parent 06bbae6 commit 530db31
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions spec-gen/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ impl Spec {
index.insert(name, module_name.to_string());
}

let target_module = self.diff.modules.entry(module_name.to_string()).or_default();
target_module.merge(module);
}

for (module_name, previous_module) in previous.diff.modules.iter() {
let mut module = Module::default();
for container in &previous_module.containers {
let name = container.name.to_string();
if index.contains_key(&name) {
Expand All @@ -374,6 +380,12 @@ impl Spec {
index.insert(name, module_name.to_string());
}

let target_module = self.diff.modules.entry(module_name.to_string()).or_default();
target_module.merge(module);
}

for (module_name, previous_module) in previous.diff.modules.iter() {
let mut module = Module::default();
for type_def in &previous_module.type_defs {
let name = type_def.name.to_string();
if index.contains_key(&name) {
Expand All @@ -384,6 +396,12 @@ impl Spec {
index.insert(name, module_name.to_string());
}

let target_module = self.diff.modules.entry(module_name.to_string()).or_default();
target_module.merge(module);
}

for (module_name, previous_module) in previous.diff.modules.iter() {
let mut module = Module::default();
for f in &previous_module.fns {
let mut f = f.clone();
let fn_name = f.name.to_string();
Expand Down Expand Up @@ -449,6 +467,12 @@ impl Spec {
index.insert(fn_name, module_name.to_string());
}

let target_module = self.diff.modules.entry(module_name.to_string()).or_default();
target_module.merge(module);
}

for (module_name, previous_module) in previous.diff.modules.iter() {
let mut module = Module::default();
for trait_def in &previous_module.trait_defs {
let name = trait_def.name.to_string();
if index.contains_key(&name) {
Expand Down

0 comments on commit 530db31

Please sign in to comment.