class Myst::ClosureScope

Overview

A ClosureScope is a specially kind of Scope that allows direct access to closured entries from the parent scope, but also does not allow access to scopes beyond the parent.

Defined in:

myst/interpreter/closure_scope.cr

Constructors

Instance Method Summary

Instance methods inherited from class Myst::Scope

[](key : String) : MTValue [], []=(key : String, value : MTValue) : MTValue []=, []?(key : String) : MTValue | Nil []?, assign(key : String, value : MTValue) assign, clear(*args, **options)
clear(*args, **options, &)
clear
, each(*args, **options)
each(*args, **options, &)
each
, has_key?(key : String) has_key?, inspect(io : IO) inspect, parent : Scope | Nil parent, parent=(parent : Scope | Nil) parent=, values : Hash(String, MTValue) values, values=(values : Hash(String, MTValue)) values=

Constructor methods inherited from class Myst::Scope

new(parent : Scope | Nil = nil) new

Constructor Detail

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

[View source]

Instance Method Detail

def []=(key : String, value : MTValue) #

[View source]
def []?(key : String) #
Description copied from class Myst::Scope

The shorthand access notations (#[]?, [], #[]=) will all fall back to the parent scope if the value does not exist in this scope.

The longhand #has_key? and #assign only operate on this scope.


[View source]
def assign(key : String, value : MTValue) #

[View source]
def closed_scope : Scope #

[View source]
def closed_scope=(closed_scope : Scope) #

[View source]
def has_key?(key : String) #

[View source]