Class: Mirah::AST::ClosureDefinition

Inherits:
ClassDefinition show all
Defined in:
lib/mirah/ast/class.rb,
lib/mirah/compiler/class.rb

Instance Attribute Summary collapse

Attributes inherited from ClassDefinition

#abstract, #current_access_level, #interfaces, #superclass

Attributes included from Scope

#static_scope, #type_scope

Attributes included from Named

#name

Attributes included from Annotated

#annotations

Attributes inherited from Node

#children, #inferred_type, #newline, #parent, #position

Instance Method Summary collapse

Methods inherited from ClassDefinition

#_define_method, #append_node, #declare_field, #define_constructor, #define_method, #define_static_method, #implements, #infer, #top_level?

Methods included from Scoped

#containing_scope, #scope

Methods included from Named

#string_value, #to_s, #validate_name

Methods included from Annotated

#annotation

Methods inherited from Node

#<<, ===, #[], #[]=, #_dump, _load, #_set_parent, child, child_name, #child_nodes, #each, #empty?, #expr?, #inferred_type!, #initialize_copy, #insert, #inspect, #inspect_children, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #string_value, #temp, #to_s, #top_level?, #validate_child, #validate_children

Constructor Details

#initialize(parent, position, name, enclosing_type) ⇒ ClosureDefinition

Returns a new instance of ClosureDefinition.



174
175
176
177
178
179
# File 'lib/mirah/ast/class.rb', line 174

def initialize(parent, position, name, enclosing_type)
  super(parent, position, name, []) do
    [nil, nil]
  end
  @enclosing_type = enclosing_type
end

Instance Attribute Details

#enclosing_typeObject

Returns the value of attribute enclosing_type.



173
174
175
# File 'lib/mirah/ast/class.rb', line 173

def enclosing_type
  @enclosing_type
end

Instance Method Details

#compile(compiler, expression) ⇒ Object



27
28
29
30
31
# File 'lib/mirah/compiler/class.rb', line 27

def compile(compiler, expression)
  compiler.define_closure(self, expression)
rescue Exception => ex
  raise Mirah::InternalCompilerError.wrap(ex, self)
end