From cfaea07444a0011aa7d91ce1bcc8f105b8f283fa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 6 Nov 2003 14:41:49 +0000 Subject: [PATCH] * `null' is a nullary primop. --- src/fix-ng/eval.cc | 5 ++--- src/fix-ng/primops.cc | 2 +- src/fix-ng/primops.hh | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/fix-ng/eval.cc b/src/fix-ng/eval.cc index 1f131fb7b..8e10caa84 100644 --- a/src/fix-ng/eval.cc +++ b/src/fix-ng/eval.cc @@ -137,12 +137,12 @@ Expr evalExpr2(EvalState & state, Expr e) ATmatch(e, "Bool()", &e1) || ATmatch(e, "Function([], )", &e1, &e2) || ATmatch(e, "Attrs([])", &e1) || - ATmatch(e, "List([])", &e1) || - ATmatch(e, "Null", &e1)) + ATmatch(e, "List([])", &e1)) return e; /* Any encountered variables must be undeclared or primops. */ if (ATmatch(e, "Var()", &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); } diff --git a/src/fix-ng/primops.cc b/src/fix-ng/primops.cc index f5a278f66..df5747edd 100644 --- a/src/fix-ng/primops.cc +++ b/src/fix-ng/primops.cc @@ -227,7 +227,7 @@ Expr primToString(EvalState & state, Expr arg) } -Expr primNull(EvalState & state, Expr arg) +Expr primNull(EvalState & state) { return ATmake("Null"); } diff --git a/src/fix-ng/primops.hh b/src/fix-ng/primops.hh index 775ec5568..76d587afd 100644 --- a/src/fix-ng/primops.hh +++ b/src/fix-ng/primops.hh @@ -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);