Class: FastRuby::GetLocalsProcessor

Inherits:
SexpProcessor
  • Object
show all
Defined in:
lib/fastruby/getlocals.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGetLocalsProcessor

Returns a new instance of GetLocalsProcessor.



30
31
32
33
34
# File 'lib/fastruby/getlocals.rb', line 30

def initialize
  super()
  self.require_empty = false
  @locals = Set.new
end

Instance Attribute Details

#localsObject (readonly)

Returns the value of attribute locals.



28
29
30
# File 'lib/fastruby/getlocals.rb', line 28

def locals
  @locals
end

Class Method Details

.get_locals(tree) ⇒ Object



41
42
43
44
45
# File 'lib/fastruby/getlocals.rb', line 41

def self.get_locals(tree)
  processor = GetLocalsProcessor.new
  processor.process(tree)
  processor.locals
end

Instance Method Details

#process_lasgn(tree) ⇒ Object



36
37
38
39
# File 'lib/fastruby/getlocals.rb', line 36

def process_lasgn(tree)
   @locals << tree[1]
   tree.dup
end