diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-14 10:04:22 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-08-14 10:04:22 +0000 |
commit | efe4b690ae4de5f0adea99abb1176a64a099d433 (patch) | |
tree | 3ee26b49848b04b5f6dad8edc06509fe4d4ee067 /src/libexpr/primops.cc | |
parent | c03b729319997b4e38c3f586d7c76352228b22e7 (diff) |
* Refactoring: combine functions that take an attribute set and
functions that take a single argument (plain lambdas) into one AST
node (Function) that contains a Pattern node describing the
arguments. Current patterns are single lazy arguments (VarPat) and
matching against an attribute set (AttrsPat).
This refactoring allows other kinds of patterns to be added easily,
such as Haskell-style @-patterns, or list pattern matching.
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index c747f46c4..50a641670 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -120,11 +120,9 @@ static Expr prim_isNull(EvalState & state, const ATermVector & args) static Expr prim_isFunction(EvalState & state, const ATermVector & args) { Expr e = evalExpr(state, args[0]); - ATermList formals; - ATerm name, body, pos; - return makeBool( - matchFunction(e, formals, body, pos) || - matchFunction1(e, name, body, pos)); + Pattern pat; + ATerm body, pos; + return makeBool(matchFunction(e, pat, body, pos)); } |