Skip to content

Commit 106fbc1

Browse files
committed
Implement on RemapStart
1 parent 3eca6e4 commit 106fbc1

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

libchisel/src/remapstart.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
use std::collections::HashMap;
2+
13
use parity_wasm::elements::{ExportEntry, ExportSection, Internal, Module, Section};
24

3-
use super::{ChiselModule, ModuleError, ModuleKind, ModulePreset, ModuleTranslator};
5+
use super::{ChiselModule, ModuleConfig, ModuleError, ModuleKind, ModulePreset, ModuleTranslator};
46

57
pub struct RemapStart;
68

@@ -30,6 +32,21 @@ impl<'a> ChiselModule<'a> for RemapStart {
3032
}
3133
}
3234

35+
impl ModuleConfig for RemapStart {
36+
fn with_defaults() -> Result<Self, ModuleError> {
37+
Ok(RemapStart {})
38+
}
39+
40+
// FIXME: drop this, no need for preset here
41+
fn with_config(config: &HashMap<String, String>) -> Result<Self, ModuleError> {
42+
if let Some(preset) = config.get("preset") {
43+
RemapStart::with_preset(preset)
44+
} else {
45+
Err(ModuleError::NotSupported)
46+
}
47+
}
48+
}
49+
3350
impl ModuleTranslator for RemapStart {
3451
fn translate_inplace(&self, module: &mut Module) -> Result<bool, ModuleError> {
3552
Ok(remap_start(module))

0 commit comments

Comments
 (0)