From 437ee31fac70799f9fafc7864655283270d4fed8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 9 Dec 2014 17:02:21 +0100 Subject: mds-kbdc: m bug fixes + more test cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/mds-kbdc/compile-layout.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/mds-kbdc/compile-layout.c') diff --git a/src/mds-kbdc/compile-layout.c b/src/mds-kbdc/compile-layout.c index bd906d5..ae29046 100644 --- a/src/mds-kbdc/compile-layout.c +++ b/src/mds-kbdc/compile-layout.c @@ -174,7 +174,7 @@ static int let(size_t variable, const char32_t* restrict string, const mds_kbdc_ statement && (statement->processed != PROCESS_LEVEL)) { statement->processed = PROCESS_LEVEL; - NEW_ERROR(statement, WARNING, "does not shadow existing definition");/* TODO test */ + NEW_ERROR(statement, WARNING, "does not shadow existing definition"); error->start = lineoff; error->end = lineoff + (size_t)snprintf(NULL, 0, "\\%zu", variable); } @@ -315,7 +315,7 @@ static int call_function(mds_kbdc_tree_t* restrict tree, const char* restrict na /* Push call stack and set parameters. */ variables_stack_push(); for (i = 0; i < arg_count; i++) - fail_if (let(i, arguments[i], NULL, NULL, 0, 0)); + fail_if (let(i + 1, arguments[i], NULL, NULL, 0, 0)); /* Switch include-stack to the function's. */ fail_if (our_include_stack = mds_kbdc_include_stack_save(), our_include_stack == NULL); @@ -333,7 +333,7 @@ static int call_function(mds_kbdc_tree_t* restrict tree, const char* restrict na /* Check that the function returned a value. */ if (*return_value == NULL) - FUN_ERROR(tree, ERROR, "function ‘%s/%zu’ did not return a value", name, arg_count);/* TODO test */ + FUN_ERROR(tree, ERROR, "function ‘%s/%zu’ did not return a value", name, arg_count); goto done; } @@ -2410,7 +2410,7 @@ static int compile_map(mds_kbdc_tree_map_t* restrict tree) array that is not shadowed by an inner function- or macro-call. */ if (r && !have_side_effect) { - NEW_ERROR(tree, ERROR, "value-statement outside function without side-effects");/* TODO test */ + NEW_ERROR(tree, ERROR, "value-statement outside function without side-effects"); tree->processed = PROCESS_LEVEL; } if (have_side_effect) @@ -2422,7 +2422,7 @@ static int compile_map(mds_kbdc_tree_map_t* restrict tree) /* For simplicity we set `last_value_statement` on includes, * so we are sure `last_value_statement` has the same include-stack. */ - NEW_ERROR(previous_last_value_statement, WARNING, "value-statement has no effects");/* TODO test */ + NEW_ERROR(previous_last_value_statement, WARNING, "value-statement has no effects"); NEW_ERROR(tree, NOTE, "overridden here"); } @@ -2469,7 +2469,7 @@ static int compile_macro_call(mds_kbdc_tree_macro_call_t* restrict tree) fail_if (arg = mds_kbdc_tree_dup(tree->arguments), arg == NULL); fail_if (bad = evaluate_element(arg), bad < 0); if (bad) - return 0; + return mds_kbdc_tree_free(arg), 0; /* Get the macro's subtree and include-stack, if it has not been defined `get_macro` will add an error message -- cgit v1.2.3-70-g09d2