class Fable::CallStack::Element

Attributes

current_pointer[RW]
evaluation_stack_height_when_pushed[RW]

When this callstack element is actually a function evaluation called from the game, we need to keep track of when it was called so that we know whether there was any return value

function_start_in_output_stream[RW]

When functions are called, we trim whitespace from the start & end of what they generate, so we make sure we know where the function's start/end are

in_expression_evaluation[RW]
in_expression_evaluation?[RW]
temporary_variables[RW]
type[RW]

Public Class Methods

new(type, pointer, options = {in_expression_evaluation: false}) click to toggle source
# File lib/fable/call_stack.rb, line 233
def initialize(type, pointer, options = {in_expression_evaluation: false})
  self.current_pointer = pointer.dup
  self.in_expression_evaluation = options[:in_expression_evaluation]
  self.temporary_variables = {}
  self.function_start_in_output_stream = 0
  self.evaluation_stack_height_when_pushed = 0
  self.type = type
end

Public Instance Methods

copy() click to toggle source
# File lib/fable/call_stack.rb, line 242
def copy
  copied_element = self.class.new(type, current_pointer, in_expression_evaluation: in_expression_evaluation)
  copied_element.temporary_variables = Serializer.convert_to_runtime_objects_hash(Serializer.convert_hash_of_runtime_objects(temporary_variables))
  copied_element.evaluation_stack_height_when_pushed = evaluation_stack_height_when_pushed
  copied_element.function_start_in_output_stream = function_start_in_output_stream
  copied_element
end