From 57751fdb55ad04d82542165417511d26304cadc2 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 24 Jul 2006 15:16:03 +0000 Subject: * Refactoring to support domain checks. --- src/libexpr/nixexpr.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/libexpr/nixexpr.cc') diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 938670f5be44..cbcaec584339 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -134,9 +134,8 @@ Expr substitute(const Substitution & subs, Expr e) if (matchFunction(e, formals, body, pos)) { ATermMap map(ATgetLength(formals)); for (ATermIterator i(formals); i; ++i) { - if (!matchNoDefFormal(*i, name) && - !matchDefFormal(*i, name, def)) - abort(); + ATerm d1, d2; + if (!matchFormal(*i, name, d1, d2)) abort(); map.set(name, makeRemoved()); } Substitution subs2(&subs, &map); @@ -221,16 +220,14 @@ static void checkVarDefs2(set & done, const ATermMap & defs, Expr e) else if (matchFunction(e, formals, body, pos)) { ATermMap defs2(defs); for (ATermIterator i(formals); i; ++i) { - Expr deflt; - if (!matchNoDefFormal(*i, name) && - !matchDefFormal(*i, name, deflt)) - abort(); + Expr d1, d2; + if (!matchFormal(*i, name, d1, d2)) abort(); defs2.set(name, (ATerm) ATempty); } for (ATermIterator i(formals); i; ++i) { - Expr deflt; + Expr dummy, deflt; set done2; - if (matchDefFormal(*i, name, deflt)) + if (matchFormal(*i, name, dummy, deflt)) /* !!! check dummy */ checkVarDefs2(done2, defs2, deflt); } set done2; -- cgit 1.4.1