class Opal::ParserScope

variable defined, and it can also check its parent scope if applicable.
created inside a scope. A lexer scope can be asked if it has a local
ParserScope is used during lexing to keep track of local variables

def add_local(local)

def add_local(local)
  @locals << local
end

def has_local?(local)

def has_local?(local)
  return true if @locals.include? local
  return @parent.has_local?(local) if @parent and @block
  false
end

def initialize(type)

Parameters:
  • type (Symbol) -- scope type
def initialize(type)
  @block  = type == :block
  @locals = []
  @parent = nil
end