Add "const" function, which is the inverse of "nonconst"

This commit is contained in:
Dianne Skoll
2025-05-23 08:47:12 -04:00
parent 1df8b12e71
commit 0ec43d570c
5 changed files with 15 additions and 3 deletions
+4
View File
@@ -568,6 +568,10 @@ eval_builtin(expr_node *node, Value *locals, Value *ans, int *nonconst)
/* All went well; copy the result destructively */
(*ans) = info.retval;
/* Special case of const cunction */
if (!strcmp(f->name, "const")) {
*nonconst = 0;
}
/* Don't allow retval to be destroyed! */
info.retval.type = ERR_TYPE;
}