aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/ChangeLog8
-rw-r--r--src/interp/compiler.boot8
-rw-r--r--src/interp/define.boot21
3 files changed, 21 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a3edc2f9..24445959 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
2013-05-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+ * interp/define.boot (compDefineFunctor1): Use the current
+ instantiation form when adding modemaps from category.
+ (partialSignature?): New.
+ (refineDefinitionSignature): Use full completion from getSignature.
+ * interp/compiler.boot (compIterator): Simplify.
+
+2013-05-19 Gabriel Dos Reis <gdr@integrable-solutions.net>
+
* interp/define.boot (sourceMatches): New.
(getDollarName): Likewise.
(getSignature): Them. Tidy.
diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot
index a2907f18..43ac6566 100644
--- a/src/interp/compiler.boot
+++ b/src/interp/compiler.boot
@@ -2674,15 +2674,11 @@ compIterator(it,e) ==
it is ["STEP",index,start,inc,:optFinal] =>
compStepIterator(index,start,optFinal,inc,e)
it is ["WHILE",p] =>
- [p',m,e]:=
- comp(p,$Boolean,e) or return
- stackMessage('"WHILE operand: %1b is not Boolean valued",[p])
+ [p',m,e] := compOrCroak(p,$Boolean,e)
[["WHILE",p'],e]
it is ["UNTIL",p] => ($until:= p; ['$until,e])
it is ["|",x] =>
- u:=
- comp(x,$Boolean,e) or return
- stackMessage('"SUCHTHAT operand: %1b is not Boolean value",[x])
+ u := compOrCroak(x,$Boolean,e)
[["|",u.expr],u.env]
nil
diff --git a/src/interp/define.boot b/src/interp/define.boot
index df55d0cc..36f3bcd3 100644
--- a/src/interp/define.boot
+++ b/src/interp/define.boot
@@ -1366,9 +1366,8 @@ augModemapsFromCategory(domainName,functorForm,categoryForm,e) ==
[fnAlist,e]:= evalAndSub(domainName,functorForm,categoryForm,e)
compilerMessage('"Adding %1p modemaps",[domainName])
e:= putDomainsInScope(domainName,e)
- condlist:=[]
for [[op,sig,:.],cond,fnsel] in fnAlist repeat
- e:= addModemapKnown(op,domainName,sig,cond,fnsel,e) -- cond was cond1
+ e:= addModemapKnown(op,domainName,sig,cond,fnsel,e)
e
addConstructorModemaps(name,form is [functorName,:.],e) ==
@@ -1500,7 +1499,7 @@ compDefineFunctor1(df is ['DEF,form,signature,body],m,$e,$formalArgList) ==
for x in dbImplicitParameters db repeat getLocalIndex(db,x)
[.,.,$e] := compMakeDeclaration("$",target,$e)
if not $insideCategoryPackageIfTrue then
- $e := augModemapsFromCategory('_$,'_$,target,$e)
+ $e := augModemapsFromCategory('$,form,target,$e)
$e := put('$,'%dc,form,$e)
$signature := signature'
parSignature := dbSubstituteAllQuantified(db,signature')
@@ -1817,8 +1816,9 @@ hasSigInTargetCategory(form,target,e) ==
++ Subroutine of compDefineCapsuleFunction.
checkAndDeclare(db,form,sig,e) ==
--- arguments with declared types must agree with those in sig;
--- those that don't get declarations put into e
+ stack := nil
+ -- arguments with declared types must agree with those in sig;
+ -- those that don't get declarations put into e
for a in form.args for m in sig.source repeat
isQuasiquote m => nil -- we just built m from a.
symbolMember?(a,dbParameters db) =>
@@ -1858,6 +1858,10 @@ compArgumentConditions e ==
[n,x,T.expr]
e
+++ Return true if signature `sig' contains unspeccified modes.
+partialSignature? sig ==
+ sig.target = nil or (or/[s = nil for s in sig.source])
+
++ Subroutine of compDefineCapsuleFunction.
++ We are about to elaborate a definition with `form' as head, and
++ parameter types specified in `signature'. Refine that signature
@@ -1867,12 +1871,9 @@ refineDefinitionSignature(form,signature,e) ==
signature' :=
x := hasSigInTargetCategory(form,signature.target,e) => x
x := getSignatureFromMode(form,e) => x
- [signature.target,:[getArgumentModeOrMoan(a,form,e) for a in form.args]]
+ [signature.target,:[getArgumentMode(a,e) for a in form.args]]
signature'.source := stripOffSubdomainConditions(signature'.source,form.args)
- --obtain target type if not given
- if signature'.target = nil then
- signature'.target :=
- getSignature(form.op,signature'.source,e).target or return nil
+ partialSignature? signature' => getSignature(form.op,signature'.source,e)
signature'
++ Subroutine of compDefineCapsuleFunction.