Skip to content

Commit 45be1dd

Browse files
author
Steve Ives
committed
Make sure that <PARAMETER_SIZE> works with structure parameters.
1 parent 185135d commit 45be1dd

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

CodeGenEngine/LoopExpander.dbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ namespace CodeGen.Engine
844844
begin
845845
try
846846
begin
847-
context.CurrentStructure = new RpsStructure(loop.CurrentParameter.StructureName)
847+
loop.CurrentStructure = new RpsStructure(loop.CurrentParameter.StructureName)
848848
end
849849
catch (ex, @Exception)
850850
begin
@@ -853,7 +853,7 @@ namespace CodeGen.Engine
853853
endtry
854854
end
855855
else
856-
context.CurrentStructure = ^null
856+
loop.CurrentStructure = ^null
857857

858858
data child, @ITreeNode
859859
foreach child in node.Body

CodeGenEngine/TokenExpanders/TokenExpanderParameterLoop.dbl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,21 @@ namespace CodeGen.Engine
172172
loops, @IEnumerable<LoopNode>
173173
endparams
174174
proc
175-
lambda doExpand(catalog,iface,meth,param) param.Size.ToString()
175+
lambda doExpand(catalog,iface,meth,param)
176+
begin
177+
using param.Type select
178+
(ParameterType.Alpha,ParameterType.Decimal,ParameterType.ImpliedDecimal,ParameterType.Integer,ParameterType.Enumeration),
179+
mreturn param.Size.ToString()
180+
(ParameterType.Handle,ParameterType.BinaryHandle,ParameterType.String),
181+
mreturn 0
182+
(ParameterType.Structure),
183+
begin
184+
lambda isParameterLoop(node) (node .is. ParameterLoopNode)
185+
data loop, @ParameterLoopNode, ^as(loops.First(isParameterLoop), ParameterLoopNode)
186+
mreturn loop.CurrentStructure.Length.ToString()
187+
end
188+
endusing
189+
end
176190
mreturn ExpandParameterLoopToken(tkn, template, loops, doExpand)
177191
endmethod
178192

CodeGenEngine/TreeNodes.dbl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ namespace CodeGen.Engine
208208
public CurrentInterface, @SmcInterface
209209
public CurrentMethod, @SmcMethod
210210
public CurrentParameter, @SmcParameter
211+
public CurrentStructure, @RpsStructure
211212
endclass
212213

213214
;;; <summary>

Documentation/CodeGen.chm

311 Bytes
Binary file not shown.

Documentation/CodeGen.hsm

649 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)