aboutsummaryrefslogtreecommitdiff
path: root/src/interp
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2011-02-13 21:44:34 +0000
committerdos-reis <gdr@axiomatics.org>2011-02-13 21:44:34 +0000
commitc89e28b04cf567a2c0e20d186c9cd89b138957d5 (patch)
tree288dfdd655881c2cc554a64f5e8aa4a115ad46f7 /src/interp
parent75976e7d252b849c10767635baf27fb98af9a1b5 (diff)
downloadopen-axiom-c89e28b04cf567a2c0e20d186c9cd89b138957d5.tar.gz
* interp/buildom.boot (mkNewUnionFunList): Align arity of
'case' implementation to declared signature. (mkUnionFunList): Likewise. * interp/compiler.boot (compCase1): 'case' is now unconditionally binary. * interp/g-opt.boot (optCond): Fix thinko.
Diffstat (limited to 'src/interp')
-rw-r--r--src/interp/buildom.boot6
-rw-r--r--src/interp/compiler.boot6
-rw-r--r--src/interp/g-opt.boot2
3 files changed, 6 insertions, 8 deletions
diff --git a/src/interp/buildom.boot b/src/interp/buildom.boot
index ce70aa08..b2b5c8c3 100644
--- a/src/interp/buildom.boot
+++ b/src/interp/buildom.boot
@@ -351,7 +351,7 @@ mkNewUnionFunList(name,form is ["Union",:listOfEntries],e) ==
[[["construct",[name,type],["XLAM",["#1"],["%makepair",i,"#1"]]],
["elt",[type,name,tag],cdownFun],
["case",[$Boolean,name,tag],
- ["XLAM",["#1"],['%ieq,['%head,"#1"],i]]]]
+ ["XLAM",["#1","#2"],['%ieq,['%head,"#1"],i]]]]
for [.,tag,type] in listOfEntries for i in 0..])] where
cdownFun() ==
gg:=gensym()
@@ -413,8 +413,8 @@ mkUnionFunList(op,form is ["Union",:listOfEntries],e) ==
["XLAM",["#1"],"#1"]
typeFun() ==
p is ['%ieq,['%head,x],n] =>
- ["XLAM",["#1"],['%ieq,['%head,x],n]]
- ["XLAM",["#1"],p]
+ ["XLAM",["#1","#2"],['%ieq,['%head,x],n]]
+ ["XLAM",["#1","#2"],p]
cList:= substitute(dollarIfRepHack op,g,cList)
[cList,e]
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 597e07cb..9f7976cb 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -1529,10 +1529,8 @@ compCase1(x,m,e) ==
and modeEqual(s,m')] or return nil
fn:= (or/[mm for (mm := [.,[cond,selfn]]) in u | cond=true]) or return nil
fn := genDeltaEntry(["case",:fn],e)
- -- user-defined `case' functions really are binary, as opposed to
- -- the compiler-synthetized versions for Union instances.
- not isUnionMode(m',e') => [['%call,fn,x',MKQ m],$Boolean,e']
- [['%call,fn,x'],$Boolean,e']
+ [['%call,fn,x',MKQ m],$Boolean,e']
+
++ For `case' operation implemented in library, the second operand
diff --git a/src/interp/g-opt.boot b/src/interp/g-opt.boot
index 08683f80..d18899dc 100644
--- a/src/interp/g-opt.boot
+++ b/src/interp/g-opt.boot
@@ -312,7 +312,7 @@ optCond (x is ['%when,:l]) ==
optCond ['%when,[['%or,p1,p2],:c1],['%otherwise,:c3]]
x
for y in tails l repeat
- c := first c
+ c := first y
if c is [['%not,['%not,p]],:.] then
c.first := p
while y is [[a1,c1],[a2,c2],:y'] and EqualBarGensym(c1,c2) repeat