Class: Mirah::JVM::Types::MetaType

Inherits:
Type
  • Object
show all
Defined in:
lib/mirah/jvm/types/meta_type.rb,
lib/mirah/jvm/types/intrinsics.rb

Direct Known Subclasses

ArrayMetaType, TypeDefMeta

Constant Summary

Constants included from Logging::Logged

Logging::Logged::VLEVELS

Instance Attribute Summary collapse

Attributes inherited from Type

#inner_class, #type_system

Instance Method Summary collapse

Methods inherited from Type

#abstract?, #add_compiled_macro, #add_enumerable_macros, #add_method, #add_method_listener, #aload, #ancestors_and_interfaces, #array?, #array_type, #assignableFrom, #assignable_from?, #astore, #class_id, #compatible?, #component_type, #constructor, #declared_class_methods, #declared_constructors, #declared_instance_methods, #declared_intrinsics, #declared_macros, #dynamic?, #error?, #expand_each, #field_getter, #field_setter, #find_callable_macros, #find_callable_macros2, #find_callable_methods, #find_callable_methods2, #find_callable_static_methods, #flags, #full_name, #generic, #generic?, #getAsmType, #getDeclaredField, #getDeclaredFields, #get_method, #hasStaticField, #include, #init_value, #inner_class_getter, #inspect, #interface?, #internal_name, #intrinsics, #isAnnotation, #isArray, #isBlock, #isEnum, #isError, #isGeneric, #isMeta, #isPrimitive, #is_parent, #iterable?, #java_method, #load, #load_extensions, #macro, #macros, #matchesAnything, #method_listeners, #method_updated, #newarray, #pop, #prefix, #primitive?, #read_macrodef_annotation, #retention, #return, #store, #to_s, #type_parameters, #ungeneric, #void?, #wide?, #widen

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?

Constructor Details

#initialize(unmeta) ⇒ MetaType

Returns a new instance of MetaType.



7
8
9
10
# File 'lib/mirah/jvm/types/meta_type.rb', line 7

def initialize(unmeta)
  super(unmeta.type_system, unmeta.name)
  @unmeta = unmeta
end

Instance Attribute Details

#unmetaObject (readonly)

Returns the value of attribute unmeta.



5
6
7
# File 'lib/mirah/jvm/types/meta_type.rb', line 5

def unmeta
  @unmeta
end

Instance Method Details

#add_intrinsicsObject



292
293
294
295
296
297
298
299
300
301
# File 'lib/mirah/jvm/types/intrinsics.rb', line 292

def add_intrinsics
  add_method('class', [], @type_system.type(nil, 'java.lang.Class'), "CLASS_LITERAL") do |compiler, call, expression|
    if expression
      compiler.method.ldc_class(unmeta)
    end
  end
  add_method('[]', [], unmeta.array_type.meta) do |compiler, call, expression|
    compiler.method.ldc_class(unmeta.array_type.meta)
  end
end

#basic_typeObject



12
13
14
# File 'lib/mirah/jvm/types/meta_type.rb', line 12

def basic_type
  @unmeta.basic_type
end

#inner_class?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/mirah/jvm/types/meta_type.rb', line 45

def inner_class?
  basic_type.inner_class?
end

#interfaces(include_parent = true) ⇒ Object



37
38
39
# File 'lib/mirah/jvm/types/meta_type.rb', line 37

def interfaces(include_parent=true)
  []
end

#jvm_typeObject



41
42
43
# File 'lib/mirah/jvm/types/meta_type.rb', line 41

def jvm_type
  unmeta.jvm_type
end

#metaObject



25
26
27
# File 'lib/mirah/jvm/types/meta_type.rb', line 25

def meta
  self
end

#meta?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/mirah/jvm/types/meta_type.rb', line 21

def meta?
  true
end

#nameObject



16
17
18
19
# File 'lib/mirah/jvm/types/meta_type.rb', line 16

def name
  return @unmeta.name if @unmeta
  super
end

#superclassObject



29
30
31
32
33
34
35
# File 'lib/mirah/jvm/types/meta_type.rb', line 29

def superclass
  if @unmeta.superclass
    @unmeta.superclass.meta
  else
    nil
  end
end