From aef653a1712e6273f9b4ab5152d3b02a2989b8d0 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Wed, 6 Jan 2016 09:47:36 -0800 Subject: optFunctorBody: Take a DB argument. --- src/interp/define.boot | 2 +- src/interp/functor.boot | 32 ++++++++++++++++---------------- src/interp/nruncomp.boot | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/interp/define.boot b/src/interp/define.boot index c6cf8942..767521ab 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -1152,7 +1152,7 @@ compDefineCategory2(db,form,signature,body,m,e,$formalArgList) == if opOf(formalBody)~='Join and opOf(formalBody)~='mkCategory then formalBody := ['Join, formalBody] dbCategory(db) := formalBody - body := optFunctorBody compOrCroak(formalBody,signature'.target,e).expr + body := optFunctorBody(db,compOrCroak(formalBody,signature'.target,e).expr) if $extraParms ~= nil then formals := nil actuals := nil diff --git a/src/interp/functor.boot b/src/interp/functor.boot index 9579defb..378f8b28 100644 --- a/src/interp/functor.boot +++ b/src/interp/functor.boot @@ -244,22 +244,22 @@ compCategories1(db,u,v,e) == [c,:.] := comp(macroExpand(u,e),v,e) => c error 'compCategories1 -optFunctorBody x == +optFunctorBody(db,x) == atomic? x => x x is ['DomainSubstitutionMacro,parms,body] => - optFunctorBody DomainSubstitutionFunction(parms,body) + optFunctorBody(db,DomainSubstitutionFunction(parms,body)) x is ['%list,:l] => null l => nil - l:= [optFunctorBody u for u in l] + l:= [optFunctorBody(db,u) for u in l] every?(function optFunctorBodyQuotable,l) => quote [optFunctorBodyRequote u for u in l] ['%list,:l] - x is ['PROGN,:l] => ['%seq,:optFunctorPROGN l] + x is ['PROGN,:l] => ['%seq,:optFunctorPROGN(db,l)] x is ['%when,:l] => - l := [v for u in l | v := relevantClause u] where - relevantClause u == + l := [v for u in l | v := relevantClause(db,u)] where + relevantClause(db,u) == u is [pred,:conseq] => - u := [optFunctorBody pred,:optFunctorPROGN conseq] + u := [optFunctorBody(db,pred),:optFunctorPROGN(db,conseq)] u is ['%otherwise] => nil u nil @@ -273,7 +273,7 @@ optFunctorBody x == first pred="HasCategory" => nil ['%when,:l] ['%when,:l] - [optFunctorBody first x,:optFunctorBody rest x] + [optFunctorBody(db,first x),:optFunctorBody(db,rest x)] optFunctorBodyQuotable u == u = nil or integer? u or string? u => true @@ -286,17 +286,17 @@ optFunctorBodyRequote u == u is ['QUOTE,v] => v systemErrorHere ["optFunctorBodyRequote",u] -optFunctorPROGN l == +optFunctorPROGN(db,l) == l is [x,:l'] => - worthlessCode x => optFunctorPROGN l' - l':= optFunctorBody l' - l' is [nil] => [optFunctorBody x] - [optFunctorBody x,:l'] + worthlessCode(db,x) => optFunctorPROGN(db,l') + l':= optFunctorBody(db,l') + l' is [nil] => [optFunctorBody(db,x)] + [optFunctorBody(db,x),:l'] l -worthlessCode x == - x is ['%when,:l] => and/[x is [.,y] and worthlessCode y for x in l] - x is ['PROGN,:l] => optFunctorPROGN l = nil +worthlessCode(db,x) == + x is ['%when,:l] => and/[x is [.,y] and worthlessCode(db,y) for x in l] + x is ['PROGN,:l] => optFunctorPROGN(db,l) = nil x is ['%list] => true x = nil => true false diff --git a/src/interp/nruncomp.boot b/src/interp/nruncomp.boot index f12dd29e..7a53fe1e 100644 --- a/src/interp/nruncomp.boot +++ b/src/interp/nruncomp.boot @@ -516,8 +516,8 @@ buildFunctor(db,sig,code,$locals,$e) == --CODE: part 3 codePart3 := $epilogue ans := ["%bind",bindings, - ['%seq,:washFunctorBody optFunctorBody - [:codePart1,:codePart2,:codePart3],"$"]] + ['%seq,:washFunctorBody optFunctorBody(db, + [:codePart1,:codePart2,:codePart3]),"$"]] $getDomainCode := nil --if we didn't kill this, DEFINE would insert it in the wrong place SAY ['"time taken in buildFunctor: ",TEMPUS_-FUGIT()-oldtime] -- cgit v1.2.3