Sensible error messages when a silly addition is performed.

Fix a test to no longer perform an invalid addition.
This commit is contained in:
Stephen Dolan committed 2012-09-10 16:15:05 +01:00
1 parent a3e509034b
commit e718bd50b6
5 files changed
+40 -4

No files matched your search

+20 -2
View File
@@ -376,7 +376,16 @@ jv jq_next() {
struct cfunction* func = &frame_current_bytecode(&frame_stk)->globals->cfunctions[*pc++];
func->fptr(cfunc_input, cfunc_output);
top.value = cfunc_output[0];
stack_push(top);
if (jv_is_valid(top.value)) {
stack_push(top);
} else {
jv msg = jv_invalid_get_msg(top.value);
if (jv_get_kind(msg) == JV_KIND_STRING) {
fprintf(stderr, "jq: error: %s\n", jv_string_value(msg));
}
jv_free(msg);
goto do_backtrack;
}
break;
}
@@ -393,7 +402,16 @@ jv jq_next() {
struct cfunction* func = &frame_current_bytecode(&frame_stk)->globals->cfunctions[*pc++];
func->fptr(cfunc_input, cfunc_output);
top.value = cfunc_output[0];
stack_push(top);
if (jv_is_valid(top.value)) {
stack_push(top);
} else {
jv msg = jv_invalid_get_msg(top.value);
if (jv_get_kind(msg) == JV_KIND_STRING) {
fprintf(stderr, "jq: error: %s\n", jv_string_value(msg));
}
jv_free(msg);
goto do_backtrack;
}
break;
}