summaryrefslogtreecommitdiff
path: root/src/wasm-binary-writer-spec.c
diff options
context:
space:
mode:
authorBen Smith <binji@chromium.org>2016-04-12 12:42:09 -0700
committerBen Smith <binji@chromium.org>2016-04-12 14:59:44 -0700
commitfb0f7da9c1ba977aa68f5e01346306ae13b8f59a (patch)
treef1ff7855186033fcb491dd2120f326a9db834397 /src/wasm-binary-writer-spec.c
parent04140042f96a68f3610b4a24fdf456b5fac9792e (diff)
downloadwabt-fb0f7da9c1ba977aa68f5e01346306ae13b8f59a.tar.gz
wabt-fb0f7da9c1ba977aa68f5e01346306ae13b8f59a.tar.bz2
wabt-fb0f7da9c1ba977aa68f5e01346306ae13b8f59a.zip
share WasmFuncDeclaration with Func and Import
There was some duplicated code between WasmFunc and WasmImport; both allow you to specify a function signature or a function type. This change introduces a WasmFuncDeclaration which is shared by both. This also allows us to remove WasmTypeBindings.
Diffstat (limited to 'src/wasm-binary-writer-spec.c')
-rw-r--r--src/wasm-binary-writer-spec.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm-binary-writer-spec.c b/src/wasm-binary-writer-spec.c
index 003decc7..4f00b3ad 100644
--- a/src/wasm-binary-writer-spec.c
+++ b/src/wasm-binary-writer-spec.c
@@ -302,8 +302,8 @@ static WasmFunc* append_nullary_func(WasmAllocator* allocator,
if (!func_field)
return NULL;
WasmFunc* func = &func_field->func;
- func->flags = WASM_FUNC_FLAG_HAS_SIGNATURE;
- func->result_type = result_type;
+ func->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE;
+ func->decl.sig.result_type = result_type;
int func_index = module->funcs.size - 1;
WasmModuleField* export_field =
@@ -379,7 +379,7 @@ static void write_commands(WasmWriteSpecContext* ctx, WasmScript* script) {
int func_index = wasm_get_func_index_by_var(last_module, &export->var);
assert(func_index >= 0 && (size_t)func_index < last_module->funcs.size);
WasmFunc* callee = last_module->funcs.data[func_index];
- WasmType result_type = callee->result_type;
+ WasmType result_type = wasm_get_result_type(callee);
/* these pointers will be invalidated later, so we can't use them */
export = NULL;
callee = NULL;
@@ -469,7 +469,7 @@ static void write_commands(WasmWriteSpecContext* ctx, WasmScript* script) {
WASM_TYPE_I32, name);
CHECK_ALLOC_NULL(caller);
CHECK_ALLOC(wasm_append_type_value(
- script->allocator, &caller->locals.types, &result_type));
+ script->allocator, &caller->local_types, &result_type));
expr_ptr = wasm_append_expr_ptr(script->allocator, &caller->exprs);
CHECK_ALLOC_NULL(expr_ptr);
*expr_ptr = create_set_local_expr(