aboutsummaryrefslogtreecommitdiff
path: root/src/boot/ast.boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-06-01 09:09:23 +0000
committerdos-reis <gdr@axiomatics.org>2012-06-01 09:09:23 +0000
commit967f23ac31a0833c680ba4144c28e27bae8c7ee1 (patch)
treeece4e7f1d9efc4568b617922075fee8851ad6a9a /src/boot/ast.boot
parent04db207b8714da06dd02bdf68163604aeb5e401c (diff)
downloadopen-axiom-967f23ac31a0833c680ba4144c28e27bae8c7ee1.tar.gz
* boot/ast.boot (%LoadUnit): Add field for enclosing function.
Remove references to $op.
Diffstat (limited to 'src/boot/ast.boot')
-rw-r--r--src/boot/ast.boot21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index 91a3d030..ff360d3a 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -120,7 +120,7 @@ structure %Ast ==
structure %LoadUnit ==
Record(fdefs: %List %Thing,sigs: %List %Thing,xports: %List %Identifier,_
csts: %List %Binding,varno: %Short,letno: %Short,isno: %Short,_
- sconds: %List %Thing) with
+ sconds: %List %Thing,op: %Identifier) with
functionDefinitions == (.fdefs) -- functions defined in this TU
globalSignatures == (.sigs) -- signatures proclaimed by this TU
exportedNames == (.xports) -- names exported by this TU
@@ -129,9 +129,10 @@ structure %LoadUnit ==
letVariableNumer == (.letno) -- let variable sequence number
isVariableNumber == (.isno) -- is variable sequence number
sideConditions == (.sconds) -- list of side declarations
+ enclosingFunction == (.op) -- name of current enclosing function
makeLoadUnit() ==
- mk%LoadUnit(nil,nil,nil,nil,0,0,0,nil)
+ mk%LoadUnit(nil,nil,nil,nil,0,0,0,nil,nil)
pushFunctionDefinition(tu,def) ==
functionDefinitions(tu) := [def,:functionDefinitions tu]
@@ -601,7 +602,7 @@ bfSUBLIS1(p,e)==
sameObject?(first f,e) => bfSUBLIS(p, rest f)
bfSUBLIS1(rest p,e)
-defSheepAndGoats(x)==
+defSheepAndGoats(tu,x)==
case x of
%Definition(op,args,body) =>
argl :=
@@ -610,17 +611,17 @@ defSheepAndGoats(x)==
argl = nil =>
opassoc := [[op,:body]]
[opassoc,[],[]]
- op1 := makeSymbol strconc(symbolName $op,'",",symbolName op)
+ op1 := makeSymbol strconc(symbolName enclosingFunction tu,'",",symbolName op)
opassoc := [[op,:op1]]
defstack := [[op1,args,body]]
[opassoc,defstack,[]]
- %Pile defs => defSheepAndGoatsList defs
+ %Pile defs => defSheepAndGoatsList(tu,defs)
otherwise => [[],[],[x]]
-defSheepAndGoatsList(x)==
+defSheepAndGoatsList(tu,x)==
x = nil => [[],[],[]]
- [opassoc,defs,nondefs] := defSheepAndGoats first x
- [opassoc1,defs1,nondefs1] := defSheepAndGoatsList rest x
+ [opassoc,defs,nondefs] := defSheepAndGoats(tu,first x)
+ [opassoc1,defs1,nondefs1] := defSheepAndGoatsList(tu,rest x)
[[:opassoc,:opassoc1],[:defs,:defs1],[:nondefs,:nondefs1]]
--% LET
@@ -1166,7 +1167,7 @@ groupFluidVars(inits,vars,stmts) ==
["LET*",inits,["DECLARE",["SPECIAL",:vars]],bfMKPROGN stmts]
bfTagged(tu,a,b)==
- $op = nil => %Signature(a,b) -- surely a toplevel decl
+ enclosingFunction tu = nil => %Signature(a,b) -- surely a toplevel decl
symbol? a =>
b is "local" => bfLET(tu,compFluid a,nil)
$typings := [["TYPE",b,a],:$typings]
@@ -1263,7 +1264,7 @@ bfSequence l ==
["COND",:transform,bfAlternative('T,bfSequence aft)]
bfWhere(tu,context,expr)==
- [opassoc,defs,nondefs] := defSheepAndGoats context
+ [opassoc,defs,nondefs] := defSheepAndGoats(tu,context)
a:=[[first d,second d,bfSUBLIS(opassoc,third d)]
for d in defs]
sideConditions(tu) := [:a,:sideConditions tu]