Ameba::AST::Scope
Represents a context of the local variable visibility. This is where the local variables belong to.
Constructors
Creates a new scope. Accepts the AST node and the outer scope.
scope = Scope.new(class_node, nil)
Instance methods
Returns true if this reference is the same as other. Invokes same?.
Creates a new argument in the current scope.
scope = Scope.new(class_node, nil)
scope.add_argument(arg_node)
Adds a new instance variable to the current scope.
scope = Scope.new(class_node, nil)
scope.add_ivariable(ivar_node)
Adds a new type declaration variable to the current scope.
scope = Scope.new(class_node, nil)
scope.add_type_dec_variable(node)
Creates a new variable in the current scope.
scope = Scope.new(class_node, nil)
scope.add_variable(var_node)
Creates a new assignment for the variable.
scope = Scope.new(class_node, nil)
scope.assign_variable(var_name, assign_node)
Returns true if type declaration variable is assigned in this scope.
Returns true if current scope is a class def, false otherwise.
Returns true if a local variable named name has a definition that
reaches the program point where node (an inner scope's node) is
introduced.
scope.declared_at?("foo", block_node)
Returns true if current scope is a enum def, false otherwise.
Returns variable by its name or nil if it does not exist.
scope = Scope.new(class_node, nil)
scope.find_variable("foo")
Returns true if current scope is a fun def, false otherwise.
See Object#hash(hasher)
Returns true if current scope is a lib def, false otherwise.
Returns true if current scope is a module def, false otherwise.
Returns true if current scope (or any of inner scopes) references variable,
false otherwise.
Returns true if and only if current scope represents some
type definition, for example a class.
Returns true if current scope (or any of inner scopes) yields,
false otherwise.