Class: Duby::AST::ClosureDefinition

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

Instance Attribute Summary collapse

Attributes inherited from ClassDefinition

#interfaces

Attributes included from Scope

#static_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_inner_class, #define_method, #define_static_method, #implements, #infer

Methods included from Named

#to_s

Methods included from Annotated

#annotation

Methods inherited from Node

#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #expr?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

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

Returns a new instance of ClosureDefinition.



134
135
136
137
138
139
# File 'lib/duby/ast/class.rb', line 134

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.



133
134
135
# File 'lib/duby/ast/class.rb', line 133

def enclosing_type
  @enclosing_type
end

Instance Method Details

#compile(compiler, expression) ⇒ Object



225
226
227
# File 'lib/duby/compiler.rb', line 225

def compile(compiler, expression)
  compiler.define_closure(self, expression)
end