Fix error message for undefined vars

This commit is contained in:
Nicolas Williams committed 2017-02-26 00:37:28 -06:00
1 parent 441b066dd8
commit 1a8a0ae0f5
2 files changed
+3 -1

No files matched your search

+2
View File
@@ -1007,6 +1007,8 @@ static int expand_call_arglist(block* b) {
if (!curr->bound_by) {
if (curr->symbol[0] == '*' && curr->symbol[1] >= '1' && curr->symbol[1] <= '3' && curr->symbol[2] == '\0')
locfile_locate(curr->locfile, curr->source, "jq: error: break used outside labeled control structure");
else if (curr->op == LOADV)
locfile_locate(curr->locfile, curr->source, "jq: error: $%s is not defined", curr->symbol);
else
locfile_locate(curr->locfile, curr->source, "jq: error: %s/%d is not defined", curr->symbol, block_count_actuals(curr->arglist));
errors++;
+1 -1
View File
@@ -278,7 +278,7 @@ null
%%FAIL
. as $foo | break $foo
jq: error: *label-foo/0 is not defined at <top-level>, line 1:
jq: error: $*label-foo is not defined at <top-level>, line 1:
[.[]|[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]]
[1,2,3,4,5]