* `null' is a nullary primop.

This commit is contained in:
Eelco Dolstra 2003-11-06 14:41:49 +00:00
parent 569e7940f8
commit cfaea07444
3 changed files with 4 additions and 5 deletions

View File

@ -137,12 +137,12 @@ Expr evalExpr2(EvalState & state, Expr e)
ATmatch(e, "Bool(<term>)", &e1) ||
ATmatch(e, "Function([<list>], <term>)", &e1, &e2) ||
ATmatch(e, "Attrs([<list>])", &e1) ||
ATmatch(e, "List([<list>])", &e1) ||
ATmatch(e, "Null", &e1))
ATmatch(e, "List([<list>])", &e1))
return e;
/* Any encountered variables must be undeclared or primops. */
if (ATmatch(e, "Var(<str>)", &s1)) {
if ((string) s1 == "null") return primNull(state);
return e;
}
@ -159,7 +159,6 @@ Expr evalExpr2(EvalState & state, Expr e)
if (primop == "derivation") return primDerivation(state, e2);
if (primop == "toString") return primToString(state, e2);
if (primop == "baseNameOf") return primBaseNameOf(state, e2);
if (primop == "null") return primNull(state, e2);
if (primop == "isNull") return primIsNull(state, e2);
else throw badTerm("undefined variable/primop", e1);
}

View File

@ -227,7 +227,7 @@ Expr primToString(EvalState & state, Expr arg)
}
Expr primNull(EvalState & state, Expr arg)
Expr primNull(EvalState & state)
{
return ATmake("Null");
}

View File

@ -25,7 +25,7 @@ Expr primBaseNameOf(EvalState & state, Expr arg);
Expr primToString(EvalState & state, Expr arg);
/* Return the null value. */
Expr primNull(EvalState & state, Expr arg);
Expr primNull(EvalState & state);
/* Determine whether the argument is the null value. */
Expr primIsNull(EvalState & state, Expr arg);