Class: Mirah::JVM::Compiler::JVMBytecode::ClosureCompiler
- Inherits:
-
Mirah::JVM::Compiler::JVMBytecode
- Object
- SimpleNodeVisitor
- Base
- Mirah::JVM::Compiler::JVMBytecode
- Mirah::JVM::Compiler::JVMBytecode::ClosureCompiler
- Defined in:
- lib/mirah/jvm/compiler/jvm_bytecode.rb
Constant Summary
Constants inherited from Mirah::JVM::Compiler::JVMBytecode
Constants included from Logging::Logged
Instance Attribute Summary
Attributes inherited from Base
#class, #filename, #method, #static
Instance Method Summary collapse
- #declared_captures ⇒ Object
-
#initialize(config, file, type, parent, scoper, typer) ⇒ ClosureCompiler
constructor
A new instance of ClosureCompiler.
- #prepare_binding(node) ⇒ Object
Methods inherited from Mirah::JVM::Compiler::JVMBytecode
#annotate, #annotation_value, #begin_main, #binding_reference, #captured_local, #captured_local_assign, #captured_local_declare, classname_from_filename, #declare_field, #declare_local, #declare_locals, #declared?, #declared_fields, #declared_locals, #define_optarg_chain, #extract_method, #file_builder, #find_ensures, #finish_main, #get_binding, #handle_ensures, #jump_if, #jump_if_not, #local, #local_assign, #logger_name, #method_body, #output_type, #print, #push_jump_scope, #real_self, #set_position, #visitArray, #visitAttrAssign, #visitBindingReference, #visitBoolean, #visitBreak, #visitCall, #visitCast, #visitClosureDefinition, #visitConstructorDefinition, #visitEmptyArray, #visitEnsure, #visitFieldAccess, #visitFieldAssign, #visitFieldDeclaration, #visitFunctionalCall, #visitHash, #visitIf, #visitImplicitNil, #visitInterfaceDeclaration, #visitLocalAccess, #visitLocalAssignment, #visitLocalDeclaration, #visitLoop, #visitMethodDefinition, #visitNext, #visitNodeList, #visitNot, #visitNull, #visitRaise, #visitRedo, #visitRegex, #visitRescue, #visitReturn, #visitSimpleString, #visitStringConcat, #visitStringEval, #visitSuper, #visitVarargsArray
Methods included from Logging::Logged
#error, #info, #log, #logger, #logger_name, #logging?, #vlog, #warning
Methods included from MethodLookup
#each_is_exact, #each_is_exact_or_subtype_or_convertible, #field_lookup, #find_jls, #find_jls2, #find_method, #find_method2, #inner_class, #is_more_specific?, #phase1, #phase2, #phase3, #primitive_convertible?
Methods inherited from Base
#base_define_method, #begin_main, #containing_scope, #create_method_builder, #defaultNode, #error, #finish_main, #generate, #get_binding, #get_scope, #inferred_type, #introduced_scope, #logger_name, #scoped_body, #scoped_local_name, #supports_invokedynamic?, #target_jvm_version, #toplevel_class, #visit, #visitArguments, #visitCharLiteral, #visitClassAppendSelf, #visitClassDefinition, #visitConstructorDefinition, #visitFixnum, #visitImplicitSelf, #visitImport, #visitMacroDefinition, #visitNodeList, #visitNoop, #visitPackage, #visitScript, #visitSelf, #visitStaticMethodDefinition, #visitUnquote, #with
Constructor Details
#initialize(config, file, type, parent, scoper, typer) ⇒ ClosureCompiler
Returns a new instance of ClosureCompiler.
1159 1160 1161 1162 1163 1164 1165 |
# File 'lib/mirah/jvm/compiler/jvm_bytecode.rb', line 1159 def initialize(config, file, type, parent, scoper, typer) super(config, scoper, typer) @file = file @type = type @jump_scope = [] @parent = parent end |
Instance Method Details
#declared_captures ⇒ Object
1187 1188 1189 |
# File 'lib/mirah/jvm/compiler/jvm_bytecode.rb', line 1187 def declared_captures @parent.declared_captures(@binding) end |
#prepare_binding(node) ⇒ Object
1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 |
# File 'lib/mirah/jvm/compiler/jvm_bytecode.rb', line 1167 def prepare_binding(node) scope = introduced_scope(node) if scope.has_binding? type = scope.binding_type @binding = @parent.get_binding(type) @method.aload 0 @method.getfield(@class, 'binding', @binding) type.store(@method, @method.local('$binding', type)) else log "No binding for #{node} (#{scope.has_binding?} #{scope.parent} #{scope.parent && scope.parent.has_binding?})" end begin yield ensure if scope.has_binding? @binding = nil end end end |