Class: Mirah::JVM::Types::LongType
- Inherits:
-
Number
- Object
- Type
- PrimitiveType
- Number
- Mirah::JVM::Types::LongType
- Defined in:
- lib/mirah/jvm/types/integers.rb
Constant Summary
Constants inherited from Number
Constants inherited from PrimitiveType
PrimitiveType::WIDENING_CONVERSIONS
Constants included from Logging::Logged
Instance Attribute Summary
Attributes inherited from Type
#inner_class, #name, #type_system
Instance Method Summary collapse
- #add_intrinsics ⇒ Object
- #box_type ⇒ Object
- #compile_widen(builder, type) ⇒ Object
- #init_value(builder) ⇒ Object
- #literal(builder, value) ⇒ Object
- #math_type ⇒ Object
- #prefix ⇒ Object
- #wide? ⇒ Boolean
Methods inherited from Number
#add_delegates, #boolean_operator, #box, #compile_boolean_operator, #delegate_intrinsic, #invert_op, #jump_if, #math_operator, #suffix, #unary_operator
Methods inherited from PrimitiveType
#convertible_to?, #initialize, #interfaces, #newarray, #primitive?, #primitive_type, #superclass
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, #basic_type, #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, #full_name, #generic, #generic?, #get_method, #include, #initialize, #inner_class?, #inner_class_getter, #inspect, #interface?, #interfaces, #intrinsics, #isArray, #isBlock, #isError, #isGeneric, #isMeta, #is_parent, #iterable?, #java_method, #jvm_type, #load, #load_extensions, #macro, #macros, #matchesAnything, #meta, #meta?, #method_listeners, #method_updated, #newarray, #pop, #primitive?, #read_macrodef_annotation, #return, #store, #superclass, #to_s, #type_parameters, #ungeneric, #unmeta, #void?, #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
This class inherits a constructor from Mirah::JVM::Types::PrimitiveType
Instance Method Details
#add_intrinsics ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/mirah/jvm/types/integers.rb', line 117 def add_intrinsics super math_operator('<<', 'shl') math_operator('>>', 'shr') math_operator('>>>', 'ushr') math_operator('|', 'or') math_operator('&', 'and') math_operator('^', 'xor') unary_operator('~', 'not') end |
#box_type ⇒ Object
86 87 88 |
# File 'lib/mirah/jvm/types/integers.rb', line 86 def box_type @type_system.type(nil, 'java.lang.Long') end |
#compile_widen(builder, type) ⇒ Object
102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/mirah/jvm/types/integers.rb', line 102 def compile_widen(builder, type) case type.name when 'long' # do nothing when 'float' builder.l2f when 'double' builder.l2d when @wrapper.java_class.name, 'java.lang.Object' builder.invokestatic @wrapper, "valueOf", [@wrapper, builder.send(name)] else raise ArgumentError, "Invalid widening conversion from Int to #{type}" end end |
#init_value(builder) ⇒ Object
94 95 96 |
# File 'lib/mirah/jvm/types/integers.rb', line 94 def init_value(builder) builder.lconst_0 end |
#literal(builder, value) ⇒ Object
90 91 92 |
# File 'lib/mirah/jvm/types/integers.rb', line 90 def literal(builder, value) builder.ldc_long(value) end |
#math_type ⇒ Object
82 83 84 |
# File 'lib/mirah/jvm/types/integers.rb', line 82 def math_type @type_system.type(nil, 'long') end |
#prefix ⇒ Object
78 79 80 |
# File 'lib/mirah/jvm/types/integers.rb', line 78 def prefix 'l' end |
#wide? ⇒ Boolean
98 99 100 |
# File 'lib/mirah/jvm/types/integers.rb', line 98 def wide? true end |