diff options
author | JSDurand <mmemmew@gmail.com> | 2023-07-16 18:06:18 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-07-16 18:06:18 +0800 |
commit | 780f3cc80cadf87ecfdb702ef90fcb606f2783fd (patch) | |
tree | 7d978d43b1c6f58c358e6f8e8d9f30c0303a7a98 /chain/src/item/genins.rs | |
parent | 6a24e0a805c597b8f835c5c72a0e4dcdd64ca39b (diff) |
Fix the bug of forgetting to check cloned nodes.
In the process of splitting, cloning, and planting the forest, I
forgot to check whether some cloned node of the node inquestion
satisfy the condition. This used to cause forests that violate some
fundamental assumptions. Now this is supposed to be fixed, but more
tests await us.
Diffstat (limited to 'chain/src/item/genins.rs')
-rw-r--r-- | chain/src/item/genins.rs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/chain/src/item/genins.rs b/chain/src/item/genins.rs index ce34df9..ac521cc 100644 --- a/chain/src/item/genins.rs +++ b/chain/src/item/genins.rs @@ -213,7 +213,7 @@ impl DefaultForest<ForestLabel<GrammarLabel>> { // operation for debugging purposes. let mut to_print = true; - if std::fs::metadata(format!("output/")).is_err() { + if std::fs::metadata("output/").is_err() { to_print = false; } @@ -578,8 +578,15 @@ impl DefaultForest<ForestLabel<GrammarLabel>> { let mut result = None; + // dbg!(leaf_label, &fragment); + + // crate::item::default::print_labels(atom, fragment).unwrap(); + + // dbg!(self.vertex_label(node)?); + for (index, child) in self.children_of(node)?.enumerate() { - if matches!(self.vertex_label(child)?, Some(child_label) if child_label == leaf_label) + // dbg!(self.vertex_label(child)?, child); + if matches!(self.vertex_label(child)?, Some(child_label) if child_label.label() == leaf_label.label()) { result = Some((index, child)); break; |