Extractor: fix child index values

This commit is contained in:
Arthur Baars
2020-10-27 22:31:52 +01:00
parent 0c15783f2b
commit fe1d8ec15f
2 changed files with 5 additions and 9 deletions

View File

@@ -232,8 +232,8 @@ impl Visitor<'_> {
)
}
}
Storage::Table { index } => {
for child_id in child_ids {
Storage::Table => {
for (index, child_id) in child_ids.iter().enumerate() {
self.trap_output.push(TrapEntry::ChildOf(
node_type_name(&field.parent.kind, field.parent.named),
parent_id,
@@ -241,7 +241,7 @@ impl Visitor<'_> {
Some(name) => name.to_owned(),
None => "child".to_owned(),
},
Index(*index),
Index(index),
*child_id,
));
}

View File

@@ -38,9 +38,7 @@ pub enum Storage {
/// the field is stored as a column in the parent table
Column,
// the field is store in a link table
Table {
index: usize,
},
Table,
}
pub fn read_node_types(node_types_path: &Path) -> std::io::Result<Vec<Entry>> {
@@ -123,9 +121,7 @@ fn add_field(
} else {
// This field can appear zero or multiple times, so put
// it in an auxiliary table.
storage = Storage::Table {
index: fields.len(),
};
storage = Storage::Table;
}
fields.push(Field {
parent: TypeName {