Class: Rubex::SymbolTable::Scope::Local

Inherits:
Object
  • Object
show all
Includes:
Rubex::SymbolTable::Scope
Defined in:
lib/rubex/symbol_table/scope.rb

Overview

class Klass

Instance Attribute Summary collapse

Attributes included from Rubex::SymbolTable::Scope

#arg_entries, #c_method_entries, #carray_entries, #entries, #free_temp_entries, #global_entries, #klass_name, #name, #outer_scope, #ruby_class_entries, #ruby_constant_entries, #ruby_method_entries, #ruby_obj_entries, #self_name, #sue_entries, #temp_entries, #type, #type_entries, #var_entries

Instance Method Summary collapse

Methods included from Rubex::SymbolTable::Scope

#[], #add_c_method, #add_carray, #add_ruby_class, #add_ruby_method, #add_ruby_obj, #allocate_temp, #check_entry, #declare_sue, #declare_type, #declare_var, #find, #has_entry?, #release_temp

Constructor Details

#initialize(name, outer_scope) ⇒ Local

Returns a new instance of Local.



234
235
236
237
238
239
240
# File 'lib/rubex/symbol_table/scope.rb', line 234

def initialize name, outer_scope
  super(outer_scope)
  @name = name
  @klass_name = outer_scope.klass_name
  @begin_block_counter = 0
  @no_gil_block_counter = 0
end

Instance Attribute Details

#begin_block_counterObject (readonly)

Returns the value of attribute begin_block_counter.



231
232
233
# File 'lib/rubex/symbol_table/scope.rb', line 231

def begin_block_counter
  @begin_block_counter
end

#no_gil_block_counterObject (readonly)

Returns the value of attribute no_gil_block_counter.



231
232
233
# File 'lib/rubex/symbol_table/scope.rb', line 231

def no_gil_block_counter
  @no_gil_block_counter
end

Instance Method Details

#add_arg(name:, c_name:, type:, value:) ⇒ Object

args - Rubex::AST::ArgumentList. Creates sym. table entries for args.



243
244
245
246
247
248
249
250
# File 'lib/rubex/symbol_table/scope.rb', line 243

def add_arg name:, c_name:, type:, value:
  entry = Rubex::SymbolTable::Entry.new name, c_name, type, value
  check_entry name
  @entries[name] = entry
  @arg_entries << entry

  entry
end

#found_begin_blockObject



252
253
254
# File 'lib/rubex/symbol_table/scope.rb', line 252

def found_begin_block
  @begin_block_counter += 1
end

#found_no_gil_blockObject



256
257
258
# File 'lib/rubex/symbol_table/scope.rb', line 256

def found_no_gil_block
  @no_gil_block_counter += 1
end