diff options
author | Ben Smith <binji@chromium.org> | 2016-09-16 15:50:09 -0700 |
---|---|---|
committer | Ben Smith <binji@chromium.org> | 2016-09-29 11:37:27 -0700 |
commit | 355777d1ac0fe6820ccba45ae2c3789fbc8ccdc5 (patch) | |
tree | 606085bda6528c052231f5dacd618a930029a241 /src/wasm-ast-parser-lexer-shared.c | |
parent | 70eebc1677c98f8387aad1a55936f53cb06235ff (diff) | |
download | wabt-355777d1ac0fe6820ccba45ae2c3789fbc8ccdc5.tar.gz wabt-355777d1ac0fe6820ccba45ae2c3789fbc8ccdc5.tar.bz2 wabt-355777d1ac0fe6820ccba45ae2c3789fbc8ccdc5.zip |
WIP - parser stuff compiles
Diffstat (limited to 'src/wasm-ast-parser-lexer-shared.c')
-rw-r--r-- | src/wasm-ast-parser-lexer-shared.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/wasm-ast-parser-lexer-shared.c b/src/wasm-ast-parser-lexer-shared.c index 2ff81fd3..ca75bac6 100644 --- a/src/wasm-ast-parser-lexer-shared.c +++ b/src/wasm-ast-parser-lexer-shared.c @@ -71,9 +71,16 @@ void wasm_ast_format_error(WasmSourceErrorHandler* error_handler, va_end(args_copy); } +void wasm_destroy_optional_export(WasmAllocator* allocator, + WasmOptionalExport* export_) { + if (export_->has_export) + wasm_destroy_export(allocator, &export_->export_); +} + void wasm_destroy_exported_func(WasmAllocator* allocator, WasmExportedFunc* exported_func) { - wasm_destroy_export(allocator, &exported_func->export_); + wasm_destroy_optional_export(allocator, &exported_func->export_); + wasm_destroy_func(allocator, exported_func->func); wasm_free(allocator, exported_func->func); } @@ -115,14 +122,18 @@ void wasm_destroy_func_fields(struct WasmAllocator* allocator, } } -void wasm_destroy_memory_data_segment_pair(WasmAllocator* allocator, - WasmMemoryDataSegmentPair* pair) { - if (pair->has_data_segment) - wasm_destroy_data_segment(allocator, &pair->data_segment); +void wasm_destroy_exported_memory(WasmAllocator* allocator, + WasmExportedMemory* memory) { + wasm_destroy_memory(allocator, &memory->memory); + wasm_destroy_optional_export(allocator, &memory->export_); + if (memory->has_data_segment) + wasm_destroy_data_segment(allocator, &memory->data_segment); } -void wasm_destroy_table_elem_segment_pair(WasmAllocator* allocator, - WasmTableElemSegmentPair* pair) { - if (pair->has_elem_segment) - wasm_destroy_elem_segment(allocator, &pair->elem_segment); +void wasm_destroy_exported_table(WasmAllocator* allocator, + WasmExportedTable* table) { + wasm_destroy_table(allocator, &table->table); + wasm_destroy_optional_export(allocator, &table->export_); + if (table->has_elem_segment) + wasm_destroy_elem_segment(allocator, &table->elem_segment); } |