class SyntaxTree::WithScope::Scope::Local

This class tracks the occurrences of a local variable or argument.

Attributes

definitions[R]
Array

The locations of all definitions and assignments of

this local

type[R]
Symbol

The type of the local (e.g. :argument, :variable)

usages[R]
Array

The locations of all usages of this local

Public Class Methods

new(type) click to toggle source
# File lib/syntax_tree/with_scope.rb, line 43
def initialize(type)
  @type = type
  @definitions = []
  @usages = []
end

Public Instance Methods

add_definition(location) click to toggle source
# File lib/syntax_tree/with_scope.rb, line 49
def add_definition(location)
  @definitions << location
end
add_usage(location) click to toggle source
# File lib/syntax_tree/with_scope.rb, line 53
def add_usage(location)
  @usages << location
end