From fee9f94ea1e25df6b75df2e195500e1e97c574be Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sat, 26 Nov 2011 10:02:08 +0000 Subject: * interp/c-util.boot (updateCapsuleDirectory): Simplify. * interp/define.boot (compDefineCapsuleFunction): Call it from here. * interp/functor.boot (DescendCode): Not here. --- src/ChangeLog | 6 ++++++ src/interp/c-util.boot | 12 +++--------- src/interp/define.boot | 9 ++++++--- src/interp/functor.boot | 3 --- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 36762a23..f6fe5c1c 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2011-11-26 Gabriel Dos Reis + + * interp/c-util.boot (updateCapsuleDirectory): Simplify. + * interp/define.boot (compDefineCapsuleFunction): Call it from here. + * interp/functor.boot (DescendCode): Not here. + 2011-11-26 Gabriel Dos Reis * interp/define.boot ($NRTdeltaList): Remove. diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 3bc4a2e4..e9643db3 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1211,18 +1211,12 @@ clearCapsuleDirectory() == ++ slot number `slot'. A nil entry means that either the operation ++ is not defined, or it is conditional. getCapsuleDirectoryEntry slot == - rest ASSOC(slot,$capsuleDirectory) + scalarTarget(slot,$capsuleDirectory) ++ Update the current capsule directory with entry controlled by ++ predicate `pred'. -updateCapsuleDirectory(item,pred) == - pred ~= true => nil - entry := - item is [['$,slot],['CONS,['dispatchFunction,fun],:.],:.] => [slot,:fun] - item is [['$,slot],['CONS,'IDENTITY, - ['FUNCALL,['dispatchFunction,fun],'$]]] => [slot,:fun] - nil - entry = nil => nil +updateCapsuleDirectory(entry,pred) == + pred isnt true => nil $capsuleDirectory := [entry,:$capsuleDirectory] diff --git a/src/interp/define.boot b/src/interp/define.boot index 644f71dd..abc12e16 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1848,13 +1848,14 @@ compDefineCapsuleFunction(db,df is ['DEF,form,signature,body], formattedSig := formatUnabbreviatedSig signature sayBrightly ['" compiling ",localOrExported, :bright $op,'": ",:formattedSig] - - noteCapsuleFunctionDefinition($op,signature,makePredicate $predl) + + pred := makePredicate $predl + noteCapsuleFunctionDefinition($op,signature,pred) T := CATCH('compCapsuleBody, compOrCroak(body,rettype,e)) or [$ClearBodyToken,rettype,e] - assignCapsuleFunctionSlot(db,$op,signature) -- A THROW to the above CATCH occurs if too many semantic errors occur -- see stackSemanticError + n := assignCapsuleFunctionSlot(db,$op,signature) -- Build a name for the implementation. op' := localOperation?($op,e) => @@ -1863,6 +1864,8 @@ compDefineCapsuleFunction(db,df is ['DEF,form,signature,body], userError ['"%b",$op,'"%d",'" is local and exported"] makeSymbol strconc(encodeItem $prefix,'";",encodeItem $op) encodeFunctionName(db,$op,signature,'";",$suffix) + if n ~= nil and not $insideCategoryPackageIfTrue then + updateCapsuleDirectory([n,:op'],pred) -- Let the backend know about this function's type if $optProclaim then proclaimCapsuleFunction(op',signature) diff --git a/src/interp/functor.boot b/src/interp/functor.boot index 1cf807a9..5a71aaf7 100644 --- a/src/interp/functor.boot +++ b/src/interp/functor.boot @@ -477,9 +477,6 @@ DescendCode(db,code,flag,viewAssoc,e) == '$ body:= ['CONS,implem,dom] u := SetFunctionSlots(sig,body,flag,'original) - -- ??? We do not resolve default definitions, yet. - if not $insideCategoryPackageIfTrue then - updateCapsuleDirectory([second(u).args,third u],flag) ConstantCreator u => if flag ~= true then u:= ['%when,[ProcessCond(db,flag,e),u]] $ConstantAssignments:= [u,:$ConstantAssignments] -- cgit v1.2.3