From 4235e2d5a50959dfd6813f4c854abcc7f3b65639 Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Thu, 7 Jan 2016 00:49:28 -0800 Subject: Remove dead code. Add DB parameter for getFormModemaps. --- src/interp/c-util.boot | 25 ------------------------- src/interp/compiler.boot | 12 ++++++------ src/interp/define.boot | 37 +++++++++++++++++++------------------ 3 files changed, 25 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index 58706ec0..9e56bb12 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -1207,31 +1207,6 @@ old2NewModemaps x == x is [dcSig,[pred,:.],:.] => [dcSig,pred] x -traceUp() == - $x isnt [.,:.] => sayBrightly "$x is an atom" - for y in rest $x repeat - u:= comp(y,$EmptyMode,$f) => - sayBrightly [y,'" ==> mode",'"%b",u.mode,'"%d"] - sayBrightly [y,'" does not compile"] - -traceDown() == - mmList:= getFormModemaps($x,$f) => - for mm in mmList repeat if u:= qModemap mm then return u - sayBrightly "no modemaps for $x" - -qModemap mm == - sayBrightly ['"%b","modemap",'"%d",:formatModemap mm] - [[dc,target,:sl],[pred,:.]]:= mm - and/[qArg(a,m) for a in rest $x for m in sl] => target - sayBrightly ['"%b","fails",'"%d",'"%l"] - -qArg(a,m) == - yesOrNo:= - u:= comp(a,m,$f) => "yes" - "no" - sayBrightly [a," --> ",m,'"%b",yesOrNo,'"%d"] - yesOrNo="yes" - displayProplist(x,alist) == sayBrightly ["properties of",'"%b",x,'"%d",":"] fn alist where diff --git a/src/interp/compiler.boot b/src/interp/compiler.boot index 0ff039f3..2a3f413e 100644 --- a/src/interp/compiler.boot +++ b/src/interp/compiler.boot @@ -71,7 +71,7 @@ primitiveType: (%Maybe %Database,%Form,%Mode) -> %Mode modeEqual: (%Form,%Form) -> %Boolean hasUniqueCaseView: (%Form,%Mode,%Env) -> %Boolean convertOrCroak: (%Triple,%Mode) -> %Maybe %Triple -getFormModemaps: (%Form,%Env) -> %List %Modemap +getFormModemaps: (%Maybe %Database,%Form,%Env) -> %List %Modemap reshapeArgumentList: (%Form,%Sig) -> %Form applyMapping: (%Form,%Mode,%Env,%List %Mode) -> %Maybe %Triple @@ -525,14 +525,14 @@ compForm1(db,form is [op,:argl],m,e) == -- since addDomain refuses to add modemaps from Mapping (domain is ['Mapping,:.]) and (ans := compForm2(db,[op',:argl],m,e:= augModemapsFromDomain1(db,domain,domain,e), - [x for x in getFormModemaps([op',:argl],e) | x.mmDC = domain])) => ans + [x for x in getFormModemaps(db,[op',:argl],e) | x.mmDC = domain])) => ans ans := compForm2(db,[op',:argl],m,e:= addDomain(db,domain,e), - [x for x in getFormModemaps([op',:argl],e) | x.mmDC = domain]) => ans + [x for x in getFormModemaps(db,[op',:argl],e) | x.mmDC = domain]) => ans (op'="construct") and coerceable(domain,m,e) => (T:= comp([op',:argl],domain,e) or return nil; coerce(T,m)) nil - T := compForm2(db,form,m,e,getFormModemaps(form,e)) => T + T := compForm2(db,form,m,e,getFormModemaps(db,form,e)) => T --FIXME: remove next line when the parser is fixed. form = $Zero or form = $One => nil compToApply(op,argl,m,e) @@ -634,9 +634,9 @@ compFormWithModemap(db,form,m,e,modemap) == ++ of paramter types as arguments supplied to the form. A special ++ case is made for a modemap whose sole parameter type is a Tuple. ++ In that case, it matches any number of supplied arguments. -getFormModemaps(form is [op,:argl],e) == +getFormModemaps(db,form is [op,:argl],e) == op is ["elt",domain,op1] and isDomainForm(domain,e) => - [x for x in getFormModemaps([op1,:argl],e) | x.mmDC = domain] + [x for x in getFormModemaps(db,[op1,:argl],e) | x.mmDC = domain] op is [.,:.] => nil modemapList := get(op,"modemap",e) -- Within default implementations, modemaps cannot mention the diff --git a/src/interp/define.boot b/src/interp/define.boot index 63a5f31c..299d0304 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -717,7 +717,7 @@ clearCapsuleFunctionTable() == ++ Note: for category packages, this list is nil. $exports := nil -noteExport(form,pred) == +noteExport(db,form,pred) == -- don't recheck category package exports; we just check -- them when defining the category. Plus, we might actually -- get indirect duplicates, which is OK. @@ -2592,75 +2592,76 @@ DomainSubstitutionFunction(parameters,body) == ++ Compile exported signature `opsig' under predicate `pred' in ++ environment `env'. The parameters `sigs' is a reference to a list ++ of signatures elaborated so far. -compSignature(opsig,pred,env,sigs) == +compSignature(db,opsig,pred,env,sigs) == [op,:sig] := opsig cons? op => for y in op repeat - compSignature([y,:sig],pred,env,sigs) + compSignature(db,[y,:sig],pred,env,sigs) op in '(per rep) => stackSemanticError(['"cannot export signature for", :bright op],nil) nil - noteExport(opsig,pred) + noteExport(db,opsig,pred) deref(sigs) := [MKQ [opsig,pred],:deref sigs] ++ Subroutine of comCategory. ++ Elaborate a category-level item `x' under the predicates `predl'. ++ The parameters `sigs' and `atts' are references to list of ++ signatures and attributes elaborated so far. -compCategoryItem(x,predl,env,sigs,atts) == +compCategoryItem(db,x,predl,env,sigs,atts) == x is nil => nil --1. if x is a conditional expression, recurse; otherwise, form the predicate x is ['%when,[p,e]] => predl':= [p,:predl] e is ["PROGN",:l] => - for y in l repeat compCategoryItem(y,predl',env,sigs,atts) - compCategoryItem(e,predl',env,sigs,atts) + for y in l repeat compCategoryItem(db,y,predl',env,sigs,atts) + compCategoryItem(db,e,predl',env,sigs,atts) x is ["IF",a,b,c] => - a is ["not",p] => compCategoryItem(["IF",p,c,b],predl,env,sigs,atts) + a is ["not",p] => compCategoryItem(db,["IF",p,c,b],predl,env,sigs,atts) a is ["and",p,q] => - compCategoryItem(["IF",p,["IF",q,b,c],copyTree c],predl,env,sigs,atts) + compCategoryItem(db,["IF",p,["IF",q,b,c],copyTree c],predl,env,sigs,atts) a is ["or",p,q] => - compCategoryItem(["IF",p,b,["IF",q,copyTree b,c]],predl,env,sigs,atts) + compCategoryItem(db,["IF",p,b,["IF",q,copyTree b,c]],predl,env,sigs,atts) predl':= [a,:predl] if b~="%noBranch" then b is ["PROGN",:l] => - for y in l repeat compCategoryItem(y,predl',env,sigs,atts) - compCategoryItem(b,predl',env,sigs,atts) + for y in l repeat compCategoryItem(db,y,predl',env,sigs,atts) + compCategoryItem(db,b,predl',env,sigs,atts) c="%noBranch" => nil predl':= [["not",a],:predl] c is ["PROGN",:l] => for y in l repeat - compCategoryItem(y,predl',env,sigs,atts) - compCategoryItem(c,predl',env,sigs,atts) + compCategoryItem(db,y,predl',env,sigs,atts) + compCategoryItem(db,c,predl',env,sigs,atts) pred := (predl => MKPF(predl,"AND"); true) --2. if attribute, push it and return x is ["ATTRIBUTE",y] => -- Attribute 'nil' carries no semantics. y = "nil" => nil - noteExport(y,pred) + noteExport(db,y,pred) deref(atts) := [MKQ [y,pred],:deref atts] --3. it may be a list, with PROGN as the first, and some information as the rest x is ["PROGN",:l] => for u in l repeat - compCategoryItem(u,predl,env,sigs,atts) + compCategoryItem(db,u,predl,env,sigs,atts) -- 4. otherwise, x gives a signature for a -- single operator name or a list of names; if a list of names, -- recurse - x is ["SIGNATURE",:opsig] => compSignature(opsig,pred,env,sigs) + x is ["SIGNATURE",:opsig] => compSignature(db,opsig,pred,env,sigs) systemErrorHere ["compCategoryItem",x] compCategory: (%Form,%Mode,%Env) -> %Maybe %Triple compCategory(x,m,e) == clearExportsTable() + db := currentDB e m := resolve(m,$Category) m = $Category and x is ['CATEGORY,kind,:l] => sigs := ref nil atts := ref nil for x in l repeat - compCategoryItem(x,nil,e,sigs,atts) + compCategoryItem(db,x,nil,e,sigs,atts) rep := mkExplicitCategoryFunction(kind,deref sigs,deref atts) --if inside compDefineCategory, provide for category argument substitution [rep,m,e] -- cgit v1.2.3