Module: Ikra::Types::RubyType
- Included in:
- Symbolic::ArrayCommand, ArrayType, ClassType, InterpreterOnlyType, PrimitiveType, StructType, UnionType, UnknownType
- Defined in:
- lib/types/types/ruby_type.rb
Overview
Defines the minimal interface for Ikra types. Instances of UnionType are expected in most cases.
Constant Summary collapse
- @@next_class_id =
10
Instance Method Summary collapse
- #class_id ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
- #inspect ⇒ Object
- #is_primitive? ⇒ Boolean
- #is_union_type? ⇒ Boolean
- #should_generate_self_arg? ⇒ Boolean
- #to_array_type ⇒ Object
- #to_c_type ⇒ Object
- #to_ruby_type ⇒ Object
- #to_str ⇒ Object
- #to_union_type ⇒ Object
Instance Method Details
#class_id ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/types/types/ruby_type.rb', line 47 def class_id if @class_id == nil @class_id = @@next_class_id @@next_class_id += 1 end @class_id end |
#eql?(other) ⇒ Boolean
56 57 58 |
# File 'lib/types/types/ruby_type.rb', line 56 def eql?(other) return self == other end |
#hash ⇒ Object
60 61 62 63 |
# File 'lib/types/types/ruby_type.rb', line 60 def hash # TODO: Implement return 0 end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/types/types/ruby_type.rb', line 14 def inspect return to_s end |
#is_primitive? ⇒ Boolean
26 27 28 |
# File 'lib/types/types/ruby_type.rb', line 26 def is_primitive? false end |
#is_union_type? ⇒ Boolean
30 31 32 |
# File 'lib/types/types/ruby_type.rb', line 30 def is_union_type? false end |
#should_generate_self_arg? ⇒ Boolean
34 35 36 |
# File 'lib/types/types/ruby_type.rb', line 34 def should_generate_self_arg? return true end |
#to_array_type ⇒ Object
38 39 40 41 |
# File 'lib/types/types/ruby_type.rb', line 38 def to_array_type # TODO: This should probably not return a union type by default return ArrayType.new(self).to_union_type end |
#to_c_type ⇒ Object
22 23 24 |
# File 'lib/types/types/ruby_type.rb', line 22 def to_c_type raise NotImplementedError end |
#to_ruby_type ⇒ Object
18 19 20 |
# File 'lib/types/types/ruby_type.rb', line 18 def to_ruby_type raise NotImplementedError end |
#to_str ⇒ Object
10 11 12 |
# File 'lib/types/types/ruby_type.rb', line 10 def to_str return to_s end |