Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Commit

Permalink
Support converting custom sections from module into module scaffold (#…
Browse files Browse the repository at this point in the history
…300)

* Support converting custom sections from module into module scaffold

* bump(0.41.0): bump to 0.41.0 to patch substrate

* Revert "bump(0.41.0): bump to 0.41.0 to patch substrate"

This reverts commit 8e960e6.

* perf(builder/module): use tab instead of spaces in line 55
  • Loading branch information
clearloop authored Jan 6, 2021
1 parent 5b56959 commit 3941e5d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/builder/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl From<elements::Module> for ModuleScaffold {
let mut code: Option<elements::CodeSection> = None;
let mut data: Option<elements::DataSection> = None;

let mut other = Vec::new();
let mut sections = module.into_sections();
while let Some(section) = sections.pop() {
match section {
Expand All @@ -69,7 +70,7 @@ impl From<elements::Module> for ModuleScaffold {
elements::Section::Element(sect) => { element = Some(sect); }
elements::Section::Code(sect) => { code = Some(sect); }
elements::Section::Data(sect) => { data = Some(sect); }
_ => {}
section => other.push(section)
}
}

Expand All @@ -85,7 +86,7 @@ impl From<elements::Module> for ModuleScaffold {
element: element.unwrap_or_default(),
code: code.unwrap_or_default(),
data: data.unwrap_or_default(),
other: sections,
other,
}
}
}
Expand Down

0 comments on commit 3941e5d

Please sign in to comment.