diff options
author | Ben Smith <binjimin@gmail.com> | 2017-04-18 14:52:01 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 14:52:01 -0700 |
commit | 9b0055d1d9c75149b2c93b95117fc9af7c20ec32 (patch) | |
tree | 079c3fa307d2af7b92ca183ff680a8c76f6245b3 /src/ast-parser.y | |
parent | 50007242ecb843a94fbcc7eb118f2c58376d3858 (diff) | |
download | wabt-9b0055d1d9c75149b2c93b95117fc9af7c20ec32.tar.gz wabt-9b0055d1d9c75149b2c93b95117fc9af7c20ec32.tar.bz2 wabt-9b0055d1d9c75149b2c93b95117fc9af7c20ec32.zip |
Define the implicit func type before the function (#400)
When a function is defined without an explicit type, it will first
search the already defined (implicitly or otherwise) func types. If one
is found, it will use it. Otherwise it will define its own and use that.
The code previously would define this new type after the function, which
works but doesn't roundtrip properly because it ends up defining the
same func type twice.
Diffstat (limited to 'src/ast-parser.y')
-rw-r--r-- | src/ast-parser.y | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ast-parser.y b/src/ast-parser.y index 5f0498dd..ff788670 100644 --- a/src/ast-parser.y +++ b/src/ast-parser.y @@ -1171,8 +1171,10 @@ module_fields : | module_fields func { $$ = $1; ModuleField* field; + // Append the implicit func declaration first so it occurs before the + // func definition when serialized out to the text format. + append_implicit_func_declaration(&@2, $$, &$2->func->decl); APPEND_FIELD_TO_LIST($$, field, Func, func, @2, $2->func.release()); - append_implicit_func_declaration(&@2, $$, &field->func->decl); APPEND_ITEM_TO_VECTOR($$, funcs, field->func); INSERT_BINDING($$, func, funcs, @2, field->func->name); APPEND_INLINE_EXPORT($$, Func, @2, $2, $$->funcs.size() - 1); |