From 486ade17c9938d888d341045260af26148e233fc Mon Sep 17 00:00:00 2001 From: dos-reis Date: Mon, 14 Feb 2011 00:29:19 +0000 Subject: * interp/c-util.boot (getSuccessEnvironment): Follow through temporaries designating result of assignment. (getInverseEnvironment): Likewise. --- src/interp/c-util.boot | 4 ++++ src/interp/compiler.boot | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src/interp') diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 6d770390..05915075 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -437,6 +437,8 @@ getSuccessEnvironment(a,e) == e := getSuccessEnvironment(form,e) e a is ["not",a'] => getInverseEnvironment(a',e) + -- Follow temporaries in complex conditionals + symbol? a and (T := get(a,"value",e)) => getSuccessEnvironment(T.expr,e) e getInverseEnvironment(a,e) == @@ -453,6 +455,8 @@ getInverseEnvironment(a,e) == put(x,"condition",[newpred,:get(x,"condition",e)],e) e a is ["not",a'] => getSuccessEnvironment(a',e) + -- Follow temporaries in complex conditionals + symbol? a and (T := get(a,"value",e)) => getInverseEnvironment(T.expr,e) e ++ Give some abstract value to the variable `v' of mode `m' in `e'. diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 9f7976cb..940c296d 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -460,7 +460,7 @@ mkUnion(a,b) == hasType(x,e) == fn get(x,"condition",e) where fn x == - null x => nil + x = nil => nil x is [["case",.,y],:.] => y fn rest x @@ -1711,12 +1711,12 @@ coerceHard(T,m) == coerceExtraHard: (%Triple,%Mode) -> %Maybe %Triple coerceExtraHard(T is [x,m',e],m) == T':= autoCoerceByModemap(T,m) => T' - isUnionMode(m',e) is ["Union",:l] and (t:= hasType(x,e)) and + (t:= hasType(x,e)) and isUnionMode(m',e) is ["Union",:l] and member(t,l) and (T':= autoCoerceByModemap(T,t)) and (T'':= coerce(T',m)) => T'' m' is ['Record,:.] and m = $Expression => [['coerceRe2E,x,['ELT,COPY m',0]],m,e] - belongsTo?(m',["UnionType"],e) and hasUniqueCaseView(x,m,e) => + hasUniqueCaseView(x,m,e) and belongsTo?(m',["UnionType"],e) => autoCoerceByModemap(T,m) -- Domain instantiations are first class objects m = $Domain => -- cgit v1.2.3