summaryrefslogtreecommitdiff
path: root/src/wasm-ast-parser-lexer-shared.c
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2016-07-18 16:34:12 -0700
committerGitHub <noreply@github.com>2016-07-18 16:34:12 -0700
commit73e5bc7dd4a4e5bc7fcb842a35b91ad587f80fcb (patch)
treef510be5fdeaaca527d76350e80643a9dc042e5e3 /src/wasm-ast-parser-lexer-shared.c
parentb487574ba29dd85c64be6aa1406b58084b14b8b4 (diff)
downloadwabt-73e5bc7dd4a4e5bc7fcb842a35b91ad587f80fcb.tar.gz
wabt-73e5bc7dd4a4e5bc7fcb842a35b91ad587f80fcb.tar.bz2
wabt-73e5bc7dd4a4e5bc7fcb842a35b91ad587f80fcb.zip
WasmFuncDeclaration does not always set `sig` (#93)
Prior to this change, the AST parser would always set `sig`, even if the function had no explicit signature (i.e. it used a function type variable instead). This is OK, but it makes the flag confusing. `WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE` will be clear and `wasm_decl_has_signature` will return false, but `sig` will be valid. This change makes it so `sig` is only set when there is an explicit signature. The correct way to get the function signature is to call `wasm_decl_get_signature`, which will check whether there is a func type, and if not, will check for an explicit function signature.
Diffstat (limited to 'src/wasm-ast-parser-lexer-shared.c')
-rw-r--r--src/wasm-ast-parser-lexer-shared.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wasm-ast-parser-lexer-shared.c b/src/wasm-ast-parser-lexer-shared.c
index 865bff25..63eb44e7 100644
--- a/src/wasm-ast-parser-lexer-shared.c
+++ b/src/wasm-ast-parser-lexer-shared.c
@@ -51,7 +51,7 @@ void wasm_ast_format_error(WasmSourceErrorHandler* error_handler,
size_t source_line_length = 0;
int source_line_column_offset = 0;
size_t source_line_max_length = error_handler->source_line_max_length;
- if (loc) {
+ if (loc && lexer) {
source_line = alloca(source_line_max_length + 1);
WasmResult result = wasm_ast_lexer_get_source_line(
lexer, loc, source_line_max_length, source_line, &source_line_length,