class Cosmo::Scope
- Cosmo::Scope
- Reference
- Object
Defined in:
cosmo/runtime/scope.crConstructors
Instance Method Summary
- #as_namespace : Hash
- #assign(identifier : Token, value : ValueType, modifying_instance : Bool = false) : ValueType
- #declare(typedef : Token, identifier : Token, value : ValueType, mutable : Bool = false, visibility : Visibility = Visibility::Private) : ValueType
- #extend(other : Cosmo::Scope) : Cosmo::Scope
- #lookup(token : Token) : ValueType
- #lookup?(ident : String) : ValueType
- #lookup_at(distance : UInt32, token : Token) : ValueType
- #parent : Cosmo::Scope | Nil
- #parent=(parent : Cosmo::Scope | Nil)
-
#public?(ident : String) : Bool
Returns true if the variable exists and is public, otherwise false
-
#to_s
Returns a nicely readable and concise string representation of this object, typically intended for users.
- #variable_exists?(ident : String) : Bool
- #variables : Hash(String, {type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility})
- #variables=(variables : Hash(String, NamedTuple(type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility)))
Constructor Detail
Instance Method Detail
def declare(typedef : Token, identifier : Token, value : ValueType, mutable : Bool = false, visibility : Visibility = Visibility::Private) : ValueType
#
def public?(ident : String) : Bool
#
Returns true if the variable exists and is public, otherwise false
def to_s
#
Description copied from class Object
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
.
def variables : Hash(String, {type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility})
#
def variables=(variables : Hash(String, NamedTuple(type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility)))
#