Simplify type coercion in condition evaluation
Change nstr_mkselval() to generate values with promoted types only, and replace nstr_coerce_val() by new and simpler nstr_optype() in nstr_comp(). Replace the only remaining use of nstr_coerce_val() in surv() by nstr_promote(), and remove nstr_coerce_val(). This loses one half of the unimplemented sketch of coercions to NSC_STRING. Drop the other half from nstr_exec_val().
This commit is contained in:
parent
d2fba584e8
commit
9115c03949
4 changed files with 36 additions and 90 deletions
|
@ -71,7 +71,7 @@ surv(void)
|
|||
ptr = nstr_comp_val(ptr, &val, EF_SECTOR);
|
||||
if (!ptr)
|
||||
return RET_SYN;
|
||||
if (val.val_cat != NSC_OFF || nstr_coerce_val(&val, NSC_LONG, NULL) < 0) {
|
||||
if (val.val_cat != NSC_OFF || nstr_promote(val.val_type) != NSC_LONG) {
|
||||
pr("Can't survey this\n");
|
||||
return RET_SYN;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue