class Cosmo::Scope

Defined in:

cosmo/runtime/scope.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(parent : Nil | Cosmo::Scope = nil) #

[View source]

Instance Method Detail

def as_namespace : Hash #

[View source]
def assign(identifier : Token, value : ValueType, modifying_instance : Bool = false) : ValueType #

[View source]
def declare(typedef : Token, identifier : Token, value : ValueType, mutable : Bool = false, visibility : Visibility = Visibility::Private) : ValueType #

[View source]
def extend(other : Cosmo::Scope) : Cosmo::Scope #

[View source]
def lookup(token : Token) : ValueType #

[View source]
def lookup?(ident : String) : ValueType #

[View source]
def lookup_at(distance : UInt32, token : Token) : ValueType #

[View source]
def parent : Cosmo::Scope | Nil #

[View source]
def parent=(parent : Cosmo::Scope | Nil) #

[View source]
def public?(ident : String) : Bool #

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


[View source]
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.


[View source]
def variable_exists?(ident : String) : Bool #

[View source]
def variables : Hash(String, {type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility}) #

[View source]
def variables=(variables : Hash(String, NamedTuple(type: String, value: Cosmo::ValueType, mutable: Bool, visibility: Cosmo::AST::Visibility))) #

[View source]