From a99fade73c79d570956f95cb32a6b09913cca7cb Mon Sep 17 00:00:00 2001 From: Gabriel Dos Reis Date: Sat, 30 Jan 2016 15:15:55 -0800 Subject: Make signature definitions parts of %CompilationData. --- src/interp/c-util.boot | 5 +++-- src/interp/define.boot | 17 +++++------------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/interp/c-util.boot b/src/interp/c-util.boot index ebc90480..431e17d9 100644 --- a/src/interp/c-util.boot +++ b/src/interp/c-util.boot @@ -141,18 +141,19 @@ macro domainData d == structure %CompilationData == Record(subst: %Substitution,idata: %Substitution,bytes: List %Fixnum, shell: %Vector %Thing, items: %Buffer %Pair(%SourceEntity,%Code), - lib: %Libstream,outpath: %Pathname) with + sigdefs: %List %Thing, lib: %Libstream,outpath: %Pathname) with cdSubstitution == (.subst) cdImplicits == (.idata) cdBytes == (.bytes) cdShell == (.shell) cdItems == (.items) + cdSignatureDefinitions == (.sigdefs) cdLib == (.lib) cdOutput == (.outpath) ++ Make a fresh compilation data structure. makeCompilationData() == - mk%CompilationData(nil,nil,nil,nil,[nil,:0],nil,nil) + mk%CompilationData(nil,nil,nil,nil,[nil,:0],nil,nil,nil) ++ Subsitution that replaces parameters with formals. macro dbFormalSubst db == diff --git a/src/interp/define.boot b/src/interp/define.boot index c3c9065d..6ca0a3ec 100644 --- a/src/interp/define.boot +++ b/src/interp/define.boot @@ -696,21 +696,15 @@ emitSubdomainInfo(form,super,pred) == ++ op: name of the operation ++ sig: signature of the operation ++ pred: scope predicate of the operation. -$capsuleFunctions := nil - +++ ++ record that the operation `op' with signature `sig' and predicate ++ `pred' is defined in the current capsule of the current domain ++ being compiled. -noteCapsuleFunctionDefinition(op,sig,pred) == - listMember?([op,sig,pred],$capsuleFunctions) => +noteCapsuleFunctionDefinition(cd,op,sig,pred) == + listMember?([op,sig,pred],cdSignatureDefinitions cd) => stackAndThrow('"redefinition of %1b: %2 %3", [op,formatUnabbreviated ["Mapping",:sig],formatIf pred]) - $capsuleFunctions := [[op,sig,pred],:$capsuleFunctions] - -++ Clear the list of functions defined in the last domain capsule. -clearCapsuleFunctionTable() == - $capsuleFunctions := nil - + cdSignatureDefinitions(cd) := [[op,sig,pred],:cdSignatureDefinitions cd] ++ List of exports (paireed with scope predicate) declared in ++ the category of the currend domain or package. @@ -1989,7 +1983,7 @@ compDefineCapsuleFunction(db,df is ['DEF,form,signature,body], :bright $op,'": ",:formattedSig] pred := makePredicate $predl - noteCapsuleFunctionDefinition($op,signature,pred) + noteCapsuleFunctionDefinition(dbCompilerData db,$op,signature,pred) T := CATCH('compCapsuleBody, compOrCroak(body,rettype,e)) or [$ClearBodyToken,rettype,e] -- A THROW to the above CATCH occurs if too many semantic errors occur @@ -2301,7 +2295,6 @@ compCapsule(['CAPSULE,:itemList],m,e) == $insideExpressionIfTrue: local:= false $useRepresentationHack := true db := currentDB e - clearCapsuleFunctionTable() e := checkRepresentation(db,$addFormLhs,itemList,e) compCapsuleInner(db,itemList,m,addDomain(db,'$,e)) -- cgit v1.2.3