Class: Mirah::JVM::Compiler::JavaSource::ClosureCompiler

Inherits:
Mirah::JVM::Compiler::JavaSource show all
Defined in:
lib/mirah/jvm/compiler/java_source.rb

Constant Summary

Constants inherited from Mirah::JVM::Compiler::JavaSource

ArrayOps, JVMTypes, Operators

Instance Attribute Summary

Attributes inherited from Mirah::JVM::Compiler::JavaSource

#lvalue

Attributes inherited from Base

#class, #filename, #method, #static

Instance Method Summary collapse

Methods inherited from Mirah::JVM::Compiler::JavaSource

#_raise, #annotate, #array, #array_op, #assign, #binding_reference, #body, #boolean, #branch, #branch_expression, #break, #build_string, #call, #captured_local, #captured_local_assign, #captured_local_declare, #cast, #compile_args, #constructor, #declare_field, #declare_local, #declare_locals, #define_class, #define_closure, #define_jsni_method, #define_method, #define_optarg_chain, #empty_array, #ensure, #expr?, #field, #field_assign, #field_declare, #file_builder, #line, #local, #local_assign, #local_declare, #loop, #maybe_store, #method_call, #next, #null, #operator, #output_type, #precompile_nodes, #print, #real_self, #redo, #regexp, #rescue, #return, #scoped_body, #self_call, #self_type, #store_value, #string, #super_call, #super_method_call, #temp, #this, #to_string

Methods inherited from Base

#base_define_method, #begin_main, #body, #compile, #compile_self, #constructor, #create_method_builder, #declare_argument, #define_class, #define_main, #error, #finish_main, #fixnum, #generate, #get_binding, #import, #log, #original_create_method_builder, #scoped_body, #scoped_local_name, #toplevel_class, #with

Constructor Details

#initialize(file, type, parent) ⇒ ClosureCompiler

Returns a new instance of ClosureCompiler.



751
752
753
754
755
# File 'lib/mirah/jvm/compiler/java_source.rb', line 751

def initialize(file, type, parent)
  @file = file
  @type = type
  @parent = parent
end

Instance Method Details

#declared_capturesObject



772
773
774
# File 'lib/mirah/jvm/compiler/java_source.rb', line 772

def declared_captures
  @parent.declared_captures(@binding)
end

#prepare_binding(scope) ⇒ Object



757
758
759
760
761
762
763
764
765
766
767
768
769
770
# File 'lib/mirah/jvm/compiler/java_source.rb', line 757

def prepare_binding(scope)
  if scope.has_binding?
    type = scope.binding_type
    @binding = @parent.get_binding(type)
    @method.puts("#{type.to_source} $binding = this.binding;")
  end
  begin
    yield
  ensure
    if scope.has_binding?
      @binding = nil
    end
  end
end