class Opal::Nodes::Closure
generating breaks, nexts, returns.
Then we can use this information for control flow like
takes a note about them.
Also, while loops are not closures per se, this module also
This is not a typical node.
closure stack that we have for the nodes during compile time.
This module takes care of providing information about the
def self.add_type(name, value)
def self.add_type(name, value) const_set(name, value) @types[name] = value end
def self.type_inspect(type)
def self.type_inspect(type) @types.reject do |_name, value| (type & value) == 0 end.map(&:first).join("|") end
def initialize(node, type, parent)
def initialize(node, type, parent) @node, @type, @parent = node, type, parent @catchers = [] @throwers = {} end
def inspect
def inspect "#<Closure #{Closure.type_inspect(type)} #{@node.class}>" end
def is?(type)
def is?(type) (@type & type) != 0 end
def register_catcher(type = :return)
def register_catcher(type = :return) @catchers << type unless @catchers.include? type "$t_#{type}" end
def register_thrower(type, id)
def register_thrower(type, id) @throwers[type] = id end