NOTE: Do not call this method directly, but use v.numbering
This method is here to be implemented by subclasses.
v
The current instance of the virtual machine
position
The first available position in the environment a variable can have
Return the next available position a variable can have
# Give a position to each variable declared in the node.
# NOTE: Do not call this method directly, but use `v.numbering`
# This method is here to be implemented by subclasses.
# *`v` The current instance of the virtual machine
# *`position` The first available position in the environment a variable can have
# Return the next available position a variable can have
public fun numbering(v: VirtualMachine, position: Int): Int
do
return position
end
src/vm/variables_numbering.nit:83,2--92,4
redef fun numbering(v, position)
do
# Attribute a position to this variable
self.variable.as(not null).position = position
position += 1
# Recursively continue to numbering the variables
position = v.numbering(self.n_expr, position)
# `position` is the next available position in the environment
return position
end
src/vm/variables_numbering.nit:179,2--190,4
redef fun numbering(v, position)
do
for g in n_groups do
# Give a position to each variable declared in the header of the for
if g.variables.length == 1 then
g.variables.first.position = position
g.variables[0].position = position
position += 1
else if g.variables.length == 2 then
g.variables[0].position = position
position += 1
g.variables[1].position = position
position += 1
end
position = v.numbering(self.n_block, position)
end
return position
end
src/vm/variables_numbering.nit:255,2--272,4