Class: Mirah::Typer::JavaTyper
- Includes:
- JVM::MethodLookup, JVM::Types
- Defined in:
- lib/mirah/plugin/java.rb
Constant Summary
Constants included from JVM::Types
JVM::Types::Boolean, JVM::Types::Byte, JVM::Types::Char, JVM::Types::ClassType, JVM::Types::Double, JVM::Types::Float, JVM::Types::Int, JVM::Types::Iterable, JVM::Types::Long, JVM::Types::Null, JVM::Types::Object, JVM::Types::Short, JVM::Types::String, JVM::Types::TYPE_ORDERING, JVM::Types::Unreachable, JVM::Types::Void, JVM::Types::WIDENING_CONVERSIONS
Constants included from Mirah
Mirah::TransformError, VERSION
Instance Method Summary collapse
-
#initialize ⇒ JavaTyper
constructor
A new instance of JavaTyper.
- #method_type(typer, target_type, name, parameter_types) ⇒ Object
- #name ⇒ Object
Methods included from JVM::MethodLookup
#each_is_exact, #each_is_exact_or_subtype_or_convertible, #field_lookup, #find_jls, #find_method, #inner_class, #is_more_specific?, #log, #phase1, #phase2, #phase3, #primitive_convertible?
Methods inherited from Base
Methods included from Mirah
compile, compiler_options, compiler_options=, dest_path, dest_path=, dest_paths, dest_to_source_path, find_dest, find_source, parse, plugins, print_error, reset, run, source_path, source_path=, source_paths, typer_plugins
Constructor Details
#initialize ⇒ JavaTyper
Returns a new instance of JavaTyper.
27 28 |
# File 'lib/mirah/plugin/java.rb', line 27 def initialize end |
Instance Method Details
#method_type(typer, target_type, name, parameter_types) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/mirah/plugin/java.rb', line 34 def method_type(typer, target_type, name, parameter_types) return if target_type.nil? or parameter_types.any? {|t| t.nil?} if target_type.respond_to? :get_method method = target_type.get_method(name, parameter_types) unless method || target_type.basic_type.kind_of?(TypeDefinition) raise NoMethodError, "Cannot find %s method %s(%s) on %s" % [ target_type. ? "static" : "instance", name, parameter_types.map{|t| t.full_name}.join(', '), target_type.full_name ] end if method result = method.return_type elsif typer.last_chance && target_type. && name == 'new' && parameter_types == [] = target_type. if .respond_to?(:default_constructor) result = .default_constructor typer.last_chance = false if result end end end if result log "Method type for \"#{name}\" #{parameter_types} on #{target_type} = #{result}" else log "Method type for \"#{name}\" #{parameter_types} on #{target_type} not found" end result end |
#name ⇒ Object
30 31 32 |
# File 'lib/mirah/plugin/java.rb', line 30 def name "Java" end |