class

Cosmo::Scope

Inherits Reference / Object

Constructors

new(parent : Nil | Cosmo::Scope = nil)
Source

Instance methods

as_namespace
Source
assign(identifier : Token, value : ValueType, modifying_instance : Bool = false) : ValueType
Source
declare(typedef : Token, identifier : Token, value : ValueType, mutable : Bool = false, visibility : Visibility = Visibility::Private) : ValueType
Source
lookup(token : Token) : ValueType
Source
lookup?(ident : String) : ValueType
Source
lookup_at(distance : UInt32, token : Token) : ValueType
Source
parent
Source
parent=(parent : Cosmo::Scope | Nil)
Source
public?(ident : String) : Bool

Returns true if the variable exists and is public, otherwise false

Source
to_s

Returns a nicely readable and concise string representation of this object, typically intended for users.

This method should usually not be overridden. It delegates to #to_s(IO) which can be overridden for custom implementations.

Also see #inspect.

Source
variable_exists?(ident : String) : Bool
Source
variables
Source
variables=(variables : Hash(String, NamedTuple(type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility)))
Source