Class: Fable::VariablePointerValue
Instance Attribute Summary collapse
-
#context_index ⇒ Object
Where the variable is located -1 = default, unknown, to be determined 0 = in global scope 1+ = callstack element index + 1 (so that the first doesn’t conflict with special global scope).
Attributes inherited from Value
#value_object
#original_object, #own_debug_metadata, #parent, #path
Instance Method Summary
collapse
Methods inherited from Value
#bad_cast_exception, create
#compact_path_string, #convert_path_to_relative, #debug_line_number_of_path, #debug_metadata, #indentation_string, #resolve_path, #root_content_container
Constructor Details
#initialize(variable_name = nil, context_index = -1)) ⇒ VariablePointerValue
Returns a new instance of VariablePointerValue.
239
240
241
242
|
# File 'lib/fable/value.rb', line 239
def initialize(variable_name=nil, context_index = -1)
super(variable_name)
self.context_index = context_index
end
|
Instance Attribute Details
#context_index ⇒ Object
Where the variable is located -1 = default, unknown, to be determined 0 = in global scope 1+ = callstack element index + 1 (so that the first doesn’t conflict with special global scope)
226
227
228
|
# File 'lib/fable/value.rb', line 226
def context_index
@context_index
end
|
Instance Method Details
#cast(new_type) ⇒ Object
244
245
246
247
248
249
250
|
# File 'lib/fable/value.rb', line 244
def cast(new_type)
if new_type == self.class
return self
end
raise bad_cast_exception(new_type)
end
|
#copy ⇒ Object
256
257
258
|
# File 'lib/fable/value.rb', line 256
def copy
return VariablePointerValue.new(variable_name, context_index)
end
|
#to_s ⇒ Object
252
253
254
|
# File 'lib/fable/value.rb', line 252
def to_s
return "VariablePointerValue(#{variable_name})"
end
|
#truthy? ⇒ Boolean
235
236
237
|
# File 'lib/fable/value.rb', line 235
def truthy?
raise Error, "Shouldn't be checking the truthiness of a variable pointer"
end
|