mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-16 22:21:08 +00:00
Refactor TargetRuntime as enum
Don't rename create symbol for substrate binaries
This commit is contained in:
+3
-3
@@ -51,7 +51,7 @@ impl std::fmt::Display for Error {
|
||||
|
||||
fn has_ctor(module: &elements::Module, target_runtime: &TargetRuntime) -> bool {
|
||||
if let Some(ref section) = module.export_section() {
|
||||
section.entries().iter().any(|e| target_runtime.create_symbol == e.field())
|
||||
section.entries().iter().any(|e| target_runtime.symbols().create == e.field())
|
||||
} else {
|
||||
false
|
||||
}
|
||||
@@ -94,7 +94,7 @@ pub fn build(
|
||||
let mut ctor_module = module.clone();
|
||||
|
||||
let mut public_api_entries = public_api_entries.to_vec();
|
||||
public_api_entries.push(target_runtime.call_symbol);
|
||||
public_api_entries.push(target_runtime.symbols().call);
|
||||
if !skip_optimization {
|
||||
optimize(
|
||||
&mut module,
|
||||
@@ -104,7 +104,7 @@ pub fn build(
|
||||
|
||||
if has_ctor(&ctor_module, target_runtime) {
|
||||
if !skip_optimization {
|
||||
optimize(&mut ctor_module, vec![target_runtime.create_symbol])?;
|
||||
optimize(&mut ctor_module, vec![target_runtime.symbols().create])?;
|
||||
}
|
||||
let ctor_module = pack_instance(
|
||||
parity_wasm::serialize(module.clone()).map_err(Error::Encoding)?,
|
||||
|
||||
Reference in New Issue
Block a user