Class: Mirah::JVM::Types::PrimitiveType

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

Direct Known Subclasses

BooleanType, NarrowingType, Number, VoidType

Constant Summary

Constants inherited from AST::TypeReference

AST::TypeReference::BlockType, AST::TypeReference::ErrorType, AST::TypeReference::NoType, AST::TypeReference::NullType, AST::TypeReference::UnreachableType

Instance Attribute Summary

Attributes inherited from Type

#inner_class

Attributes inherited from AST::TypeReference

#array, #meta

Attributes included from AST::Named

#name

Attributes inherited from AST::Node

#children, #inferred_type, #newline, #parent, #position

Instance Method Summary collapse

Methods inherited from Type

#add_compiled_macro, #add_enumerable_macros, #add_macro, #add_method, #aload, #array?, #array_type, #assignable_from?, #astore, #basic_type, #compatible?, #component_type, #constructor, #declared_class_methods, #declared_constructors, #declared_instance_methods, #declared_intrinsics, #dynamic?, #expand_each, #field_getter, #field_setter, #full_name, #get_method, #include, #init_value, #inner_class?, #inner_class_getter, #inspect, #interface?, #intrinsics, #is_parent, #iterable?, #java_method, #jvm_type, #load, #load_extensions, #log, #meta, #meta?, #pop, #prefix, #return, #store, #to_source, #unmeta, #void?, #wide?, #wrap_with_scoped_body

Methods included from 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 AST::TypeReference

#==, #_dump, _load, #basic_type, #block?, #compatible?, #component_type, #eql?, #error?, #full_name, #hash, #is_parent, #iterable?, #meta?, #narrow, #null?, #to_s, #type_reference, #unmeta, #unreachable?, #void?

Methods included from AST::Named

#string_value, #to_s, #validate_name

Methods inherited from AST::Node

#<<, ===, #[], #[]=, #_dump, _load, #_set_parent, child, child_name, #child_nodes, #each, #empty?, #expr?, #inferred_type!, #initialize_copy, #insert, #inspect, #inspect_children, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #string_value, #temp, #to_s, #top_level?, #validate_child, #validate_children

Constructor Details

#initialize(type, wrapper) ⇒ PrimitiveType

Returns a new instance of PrimitiveType.



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

def initialize(type, wrapper)
  @wrapper = wrapper
  super(type)
end

Instance Method Details

#add_intrinsicsObject

Primitives define their own intrinsics instead of getting the Object ones.



412
413
# File 'lib/mirah/jvm/types/intrinsics.rb', line 412

def add_intrinsics
end

#convertible_to?(type) ⇒ Boolean

Returns:



26
27
28
29
30
# File 'lib/mirah/jvm/types/primitive_type.rb', line 26

def convertible_to?(type)
  return true if type == self
  widening_conversions = WIDENING_CONVERSIONS[self]
  widening_conversions && widening_conversions.include?(type)
end

#interfacesObject



22
23
24
# File 'lib/mirah/jvm/types/primitive_type.rb', line 22

def interfaces
  []
end

#newarray(method) ⇒ Object



18
19
20
# File 'lib/mirah/jvm/types/primitive_type.rb', line 18

def newarray(method)
  method.send "new#{name}array"
end

#primitive?Boolean

Returns:



10
11
12
# File 'lib/mirah/jvm/types/primitive_type.rb', line 10

def primitive?
  true
end

#primitive_typeObject



14
15
16
# File 'lib/mirah/jvm/types/primitive_type.rb', line 14

def primitive_type
  @wrapper::TYPE
end

#superclassObject



32
33
34
# File 'lib/mirah/jvm/types/primitive_type.rb', line 32

def superclass
  nil
end