Module: DuplicateInstruction
- Included in:
- BoolDuplicateInstruction, CodeDuplicateInstruction, ExecDuplicateInstruction, FloatDuplicateInstruction, IntDuplicateInstruction, NameDuplicateInstruction
- Defined in:
- lib/instructions/infrastructure.rb
Instance Attribute Summary collapse
-
#target_stack ⇒ Object
readonly
Returns the value of attribute target_stack.
Instance Method Summary collapse
- #cleanup ⇒ Object
- #derive ⇒ Object
- #initialize(context, target_stack) ⇒ Object
- #preconditions? ⇒ Boolean
- #setup ⇒ Object
Instance Attribute Details
#target_stack ⇒ Object (readonly)
Returns the value of attribute target_stack.
168 169 170 |
# File 'lib/instructions/infrastructure.rb', line 168 def target_stack @target_stack end |
Instance Method Details
#cleanup ⇒ Object
184 185 186 |
# File 'lib/instructions/infrastructure.rb', line 184 def cleanup pushes @target_stack, @result end |
#derive ⇒ Object
181 182 183 |
# File 'lib/instructions/infrastructure.rb', line 181 def derive @result = @arg1.clone end |
#initialize(context, target_stack) ⇒ Object
170 171 172 173 |
# File 'lib/instructions/infrastructure.rb', line 170 def initialize(context, target_stack) @target_stack = target_stack super(context) end |
#preconditions? ⇒ Boolean
175 176 177 |
# File 'lib/instructions/infrastructure.rb', line 175 def preconditions? needs @target_stack, 1 end |
#setup ⇒ Object
178 179 180 |
# File 'lib/instructions/infrastructure.rb', line 178 def setup @arg1 = @context.peek(@target_stack) end |