diff options
Diffstat (limited to 'src/symbol_resolver.rs')
-rw-r--r-- | src/symbol_resolver.rs | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/symbol_resolver.rs b/src/symbol_resolver.rs index ab4f8e1..0b89fb1 100644 --- a/src/symbol_resolver.rs +++ b/src/symbol_resolver.rs @@ -196,7 +196,7 @@ impl SymbolResolver { // The ID of a given source unit will come after the IDs of all // source units which define at least one symbol referenced in the // given source unit. - let source_order = { + let head_order = { let mut included_source_ids: Vec<usize> = Vec::new(); let mut remaining_source_ids: Vec<usize> = Vec::new(); // Reverse the order so that the root unit is the last to be added. @@ -225,22 +225,20 @@ impl SymbolResolver { let mut source_code = String::new(); - // Push head source code. - for id in &source_order { + // Push head source code in macro-definition order. + for id in &head_order { let source_unit = &self.source_units[*id]; if let Some(head) = &source_unit.source_unit.head { push_source_code_to_string(&mut source_code, head); } } - // Push main source code. - for id in source_order.iter().rev() { - let source_unit = &self.source_units[*id]; + // Push main source code in source-added order. + for source_unit in self.source_units.iter() { let main = &source_unit.source_unit.main; push_source_code_to_string(&mut source_code, &main); } - // Push tail source code. - for id in &source_order { - let source_unit = &self.source_units[*id]; + // Push tail source code in reverse source-added order. + for source_unit in self.source_units.iter().rev() { if let Some(tail) = &source_unit.source_unit.tail { push_source_code_to_string(&mut source_code, tail); } |