Class: Duby::JVM::Types::PrimitiveType

Inherits:
Type show all
Defined in:
lib/duby/jvm/types.rb,
lib/duby/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_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, #get_method, #init_value, #inner_class?, #inner_class_getter, #inspect, #interface?, #intrinsics, #is_parent, #iterable?, #java_method, #jvm_type, #load, #log, #meta, #meta?, #prefix, #return, #store, #to_source, #unmeta, #void?, #wide?

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

#==, #block?, #compatible?, #component_type, #eql?, #error?, #hash, #is_parent, #iterable?, #meta?, #narrow, #null?, #to_s, #unmeta, #unreachable?

Methods included from AST::Named

#to_s

Methods inherited from AST::Node

#<<, ===, #[], #_set_parent, child, child_name, #each, #empty?, #expr?, #initialize_copy, #insert, #inspect, #line_number, #log, #precompile, #resolve_if, #resolved!, #resolved?, #simple_name, #temp, #to_s

Constructor Details

#initialize(type, wrapper) ⇒ PrimitiveType

Returns a new instance of PrimitiveType.



157
158
159
160
# File 'lib/duby/jvm/types.rb', line 157

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.



249
250
# File 'lib/duby/jvm/types/intrinsics.rb', line 249

def add_intrinsics
end

#convertible_to?(type) ⇒ Boolean

Returns:



178
179
180
181
182
# File 'lib/duby/jvm/types.rb', line 178

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

#interfacesObject



174
175
176
# File 'lib/duby/jvm/types.rb', line 174

def interfaces
  []
end

#newarray(method) ⇒ Object



170
171
172
# File 'lib/duby/jvm/types.rb', line 170

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

#primitive?Boolean

Returns:



162
163
164
# File 'lib/duby/jvm/types.rb', line 162

def primitive?
  true
end

#primitive_typeObject



166
167
168
# File 'lib/duby/jvm/types.rb', line 166

def primitive_type
  @wrapper::TYPE
end

#superclassObject



184
185
186
# File 'lib/duby/jvm/types.rb', line 184

def superclass
  nil
end