From 0ecaa80c84fb857d75072eeac224a8f3d80138b8 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Fri, 25 Nov 2011 19:27:42 +0000 Subject: * interp/define.boot (processDefinitionParameters): New. Abstract from compDefineCapsuleFunction. (compDefineCapsuleFunction): Use it. Tidy. --- src/interp/define.boot | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) (limited to 'src/interp') diff --git a/src/interp/define.boot b/src/interp/define.boot index f684d815..89b12476 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1743,10 +1743,10 @@ hasSigInTargetCategory(form,target,e) == first potentialSigList ++ Subroutine of compDefineCapsuleFunction. -checkAndDeclare(argl,form,sig,e) == +checkAndDeclare(form,sig,e) == -- arguments with declared types must agree with those in sig; -- those that don't get declarations put into e - for a in argl for m in sig.source repeat + for a in form.args for m in sig.source repeat isQuasiquote m => nil -- we just built m from a. m1:= getArgumentMode(a,e) => not modeEqual(m1,m) => @@ -1800,6 +1800,19 @@ refineDefinitionSignature(form,signature,e) == getSignature(form.op,signature'.source,e).target or return nil signature' +++ Subroutine of compDefineCapsuleFunction. +processDefinitionParameters(form,signature,e) == + e := checkAndDeclare(form,signature,e) + e := giveFormalParametersValues(form.args,e) + e := addDomain(signature.target,e) + e := compArgumentConditions e + if $profileCompiler then + for x in form.args for t in signature.source repeat + profileRecord('arguments,x,t) + for domain in signature repeat + e := addDomain(domain,e) + e + compDefineCapsuleFunction(db,df is ['DEF,form,signature,body], m,$e,$prefix,$formalArgList) == e := $e @@ -1826,24 +1839,9 @@ compDefineCapsuleFunction(db,df is ['DEF,form,signature,body], $form := [$op,:argl] argl:= stripOffArgumentConditions argl $formalArgList:= [:argl,:$formalArgList] - signature := refineDefinitionSignature(form,signature,e) or return nil - e := checkAndDeclare(argl,form,signature,e) - e := giveFormalParametersValues(argl,e) - $signatureOfForm := signature --this global is bound in compCapsuleItems - e:= addDomain(signature.target,e) - e:= compArgumentConditions e - - if $profileCompiler then - for x in argl for t in signature.source repeat - profileRecord('arguments,x,t) - - --4. introduce needed domains into extendedEnv - for domain in signature repeat - e := addDomain(domain,e) - - --6. compile body in environment with extended environment + e := processDefinitionParameters(form,signature,e) rettype := resolve(signature.target,$returnMode) localOrExported := -- cgit v1.2.3