mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-17 17:01:30 +00:00
Lexicographical sort record types before topological sort (#94)
This commit is contained in:
@ -25,6 +25,7 @@ use wasmer_it::IType;
|
||||
|
||||
use std::collections::HashSet;
|
||||
use std::rc::Rc;
|
||||
use itertools::Itertools;
|
||||
|
||||
pub(crate) struct RecordsTransformer {
|
||||
used: HashSet<u64>,
|
||||
@ -48,7 +49,8 @@ impl RecordsTransformer {
|
||||
}
|
||||
|
||||
fn topological_sort(&mut self, exported_records: &IRecordTypes) -> InterfaceResult<()> {
|
||||
for (id, record) in exported_records {
|
||||
// sort records types inside HashMap to achieve their deterministic order
|
||||
for (id, record) in exported_records.iter().sorted_by_key(|(_, v)| &v.name) {
|
||||
self.dfs(*id, record, exported_records)?;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user