about summary refs log tree commit diff
path: root/src/fix-ng/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2003-11-05T15·34+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2003-11-05T15·34+0000
commit80bb477cc4ea5226ae760726730b3e09d21559de (patch)
tree148773dc1fc90edb88cb2128f2db164ae5b06753 /src/fix-ng/eval.cc
parent0690c1c9c01dd5889dbfccf2da6cb99f5c4e151b (diff)
* Default function arguments.
Diffstat (limited to 'src/fix-ng/eval.cc')
-rw-r--r--src/fix-ng/eval.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/fix-ng/eval.cc b/src/fix-ng/eval.cc
index 90b7ff29f261..770802f321fb 100644
--- a/src/fix-ng/eval.cc
+++ b/src/fix-ng/eval.cc
@@ -27,10 +27,13 @@ static Expr substArgs(Expr body, ATermList formals, Expr arg)
     /* Get the formal arguments. */
     while (!ATisEmpty(formals)) {
         ATerm t = ATgetFirst(formals);
-        char * s;
-        if (!ATmatch(t, "<str>", &s))
-            abort(); /* can't happen */
-        subs.set(t, undefined);
+        Expr name, def;
+        debug(printTerm(t));
+        if (ATmatch(t, "NoDefFormal(<term>)", &name))
+            subs.set(name, undefined);
+        else if (ATmatch(t, "DefFormal(<term>, <term>)", &name, &def))
+            subs.set(name, def);
+        else abort(); /* can't happen */
         formals = ATgetNext(formals);
     }
 
@@ -44,7 +47,7 @@ static Expr substArgs(Expr body, ATermList formals, Expr arg)
         Expr key = ATgetFirst(keys);
         Expr cur = subs.get(key);
         if (!cur)
-            throw badTerm(format("argument `%1%' not declared")
+            throw badTerm(format("function has no formal argument `%1%'")
                 % aterm2String(key), arg);
         subs.set(key, args.get(key));
     }