aboutsummaryrefslogtreecommitdiff
path: root/src/interp/compiler.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2010-07-05 07:48:13 +0000
committerdos-reis <gdr@axiomatics.org>2010-07-05 07:48:13 +0000
commit89a2d8163cb83cfcfe8cfb64bddb2addbf1840be (patch)
treefa36ec5dd230c306d945f7fdfde2b093ae38edf4 /src/interp/compiler.boot
parent704439cfc3b15316702dabe92419b9cd2f2fe9d7 (diff)
downloadopen-axiom-89a2d8163cb83cfcfe8cfb64bddb2addbf1840be.tar.gz
* interp/compiler.boot (compTopLevel): Bind $whereDecls.
(recordDeclarationInSideCondition): New. Update it. (compWhere): Call it. * interp/define.boot ($whereDecls): Define at toplevel. (typeDependencyPath): New. (inferConstructorImplicitParameters): Likewise. (compDefineFunctor1): Use it.
Diffstat (limited to 'src/interp/compiler.boot')
-rw-r--r--src/interp/compiler.boot20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index 44f9c6bf..77212ee9 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -100,7 +100,8 @@ compTopLevel(x,m,e) ==
$NRTderivedTargetIfTrue: local := false
$killOptimizeIfTrue: local:= false
$forceAdd: local:= false
- -- start with a base list of domains we may inline.
+ $whereDecls: local := nil
+ -- start with a base list of domains we may want to inline.
$optimizableConstructorNames: local := $SystemInlinableConstructorNames
x is ["DEF",:.] or x is ["where",["DEF",:.],:.] =>
([val,mode,.]:= compOrCroak(x,m,e); [val,mode,e])
@@ -918,13 +919,28 @@ compileQuasiquote(["[||]",:form],m,e) ==
--% WHERE
+
+++ The form `item' appears in a side condition of a where-expression.
+++ Register all declarations it locally introduces.
+recordDeclarationInSideCondition(item,e) ==
+ item is [":",x,t] =>
+ t := macroExpand(t,e)
+ IDENTP x => $whereDecls := [[x,t],:$whereDecls]
+ x is ['%Comma,:.] =>
+ $whereDecls := [:[[x',t] for x' in x.args],:$whereDecls]
+ item is ['SEQ,:stmts,["exit",.,val]] =>
+ for stmt in stmts repeat
+ recordDeclarationInSideCondition(stmt,e)
+ recordDeclarationInSideCondition(val,e)
+
compWhere: (%Form,%Mode,%Env) -> %Maybe %Triple
compWhere([.,form,:exprList],m,eInit) ==
$insideExpressionIfTrue: local:= false
- $insideWhereIfTrue: local:= true
+ $insideWhereIfTrue: local := true
e := eInit
u :=
for item in exprList repeat
+ recordDeclarationInSideCondition(item,e)
[.,.,e]:= comp(item,$EmptyMode,e) or return "failed"
u="failed" => return nil
$insideWhereIfTrue := false