This commit is contained in:
fro
2017-11-15 19:33:39 +03:00
parent b8354e292c
commit 6d42e52473
+3 -3
View File
@@ -12,7 +12,7 @@ pub fn pack_instance(raw_module: Vec<u8>, ctor_module: &mut elements::Module) {
// in order to find it in the Code section of the module // in order to find it in the Code section of the module
let create_func_id = { let create_func_id = {
let found_entry = ctor_module.export_section().expect("No export section found").entries().iter() let found_entry = ctor_module.export_section().expect("No export section found").entries().iter()
.find(|entry| CREATE_SYMBOL == entry.field()).expect("No export with name _create found"); .find(|entry| CREATE_SYMBOL == entry.field()).expect(&format!("No export with name {} found", CREATE_SYMBOL));
let function_index: usize = match found_entry.internal() { let function_index: usize = match found_entry.internal() {
&Internal::Function(index) => index as usize, &Internal::Function(index) => index as usize,
@@ -139,11 +139,11 @@ mod test {
.build() .build()
.build() .build()
.export() .export()
.field("_call") .field(CALL_SYMBOL)
.internal().func(0) .internal().func(0)
.build() .build()
.export() .export()
.field("_create") .field(CREATE_SYMBOL)
.internal().func(1) .internal().func(1)
.build() .build()
.build(); .build();