Merge pull request #114 from paritytech/ret

"return_ "-> "ret" in public api
This commit is contained in:
Sergei Pepyakin 2019-01-24 09:54:46 +01:00 committed by GitHub
commit 8ecbc8ddcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@ pub use runtime_type::inject_runtime_type;
pub struct TargetSymbols {
pub create: &'static str,
pub call: &'static str,
pub return_: &'static str,
pub ret: &'static str,
}
pub enum TargetRuntime {
@ -48,7 +48,7 @@ impl TargetRuntime {
TargetRuntime::Substrate(TargetSymbols {
create: "deploy",
call: "call",
return_: "ext_return",
ret: "ext_return",
})
}
@ -56,7 +56,7 @@ impl TargetRuntime {
TargetRuntime::PWasm(TargetSymbols {
create: "deploy",
call: "call",
return_: "ret",
ret: "ret",
})
}

View File

@ -87,7 +87,7 @@ pub fn pack_instance(raw_module: Vec<u8>, mut ctor_module: elements::Module, tar
let mut found = false;
for entry in ctor_module.import_section().ok_or(Error::NoImportSection)?.entries().iter() {
if let External::Function(_) = *entry.external() {
if entry.field() == target.symbols().return_ { found = true; break; }
if entry.field() == target.symbols().ret { found = true; break; }
else { id += 1; }
}
}
@ -102,7 +102,7 @@ pub fn pack_instance(raw_module: Vec<u8>, mut ctor_module: elements::Module, tar
mbuilder.push_import(
builder::import()
.module("env")
.field(&target.symbols().return_)
.field(&target.symbols().ret)
.external().func(import_sig)
.build()
);