mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
Reducing primitive errors to warnings.
Should add an option to escalate all warnings to errors.
This commit is contained in:
parent
95215e9228
commit
39b67ea455
1 changed files with 11 additions and 9 deletions
10
eval.c
10
eval.c
|
@ -961,18 +961,20 @@ static sexp analyze (sexp ctx, sexp object) {
|
||||||
} else if (sexp_opcodep(op)) {
|
} else if (sexp_opcodep(op)) {
|
||||||
res = sexp_length(ctx, sexp_cdr(x));
|
res = sexp_length(ctx, sexp_cdr(x));
|
||||||
if (sexp_unbox_fixnum(res) < sexp_opcode_num_args(op)) {
|
if (sexp_unbox_fixnum(res) < sexp_opcode_num_args(op)) {
|
||||||
res = sexp_compile_error(ctx, "not enough args for opcode", x);
|
sexp_warn(ctx, "not enough args for opcode: ", x);
|
||||||
|
op = analyze_var_ref(ctx, sexp_car(x), NULL);
|
||||||
} else if ((sexp_unbox_fixnum(res) > sexp_opcode_num_args(op))
|
} else if ((sexp_unbox_fixnum(res) > sexp_opcode_num_args(op))
|
||||||
&& (! sexp_opcode_variadic_p(op))) {
|
&& (! sexp_opcode_variadic_p(op))) {
|
||||||
res = sexp_compile_error(ctx, "too many args for opcode", x);
|
sexp_warn(ctx, "too many args for opcode: ", x);
|
||||||
} else {
|
op = analyze_var_ref(ctx, sexp_car(x), NULL);
|
||||||
|
}
|
||||||
res = analyze_app(ctx, sexp_cdr(x));
|
res = analyze_app(ctx, sexp_cdr(x));
|
||||||
if (! sexp_exceptionp(res)) {
|
if (! sexp_exceptionp(res)) {
|
||||||
|
/* push op, which will be a direct opcode if the call is valid */
|
||||||
sexp_push(ctx, res, op);
|
sexp_push(ctx, res, op);
|
||||||
if (sexp_pairp(res))
|
if (sexp_pairp(res))
|
||||||
sexp_pair_source(res) = sexp_pair_source(x);
|
sexp_pair_source(res) = sexp_pair_source(x);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
res = analyze_app(ctx, x);
|
res = analyze_app(ctx, x);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue