Class: Steep::AST::Types::Boolean
- Inherits:
-
Object
- Object
- Steep::AST::Types::Boolean
- Defined in:
- lib/steep/ast/types/boolean.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #back_type ⇒ Object
- #free_variables ⇒ Object
- #hash ⇒ Object
-
#initialize(location: nil) ⇒ Boolean
constructor
A new instance of Boolean.
- #level ⇒ Object
- #subst(s) ⇒ Object
- #to_s ⇒ Object
- #with_location(new_location) ⇒ Object
Constructor Details
#initialize(location: nil) ⇒ Boolean
Returns a new instance of Boolean.
7 8 9 |
# File 'lib/steep/ast/types/boolean.rb', line 7 def initialize(location: nil) @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/steep/ast/types/boolean.rb', line 5 def location @location end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
11 12 13 |
# File 'lib/steep/ast/types/boolean.rb', line 11 def ==(other) other.is_a?(Boolean) end |
#back_type ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'lib/steep/ast/types/boolean.rb', line 41 def back_type Union.build(types: [ Builtin::TrueClass.instance_type, Builtin::FalseClass.instance_type ], location: location) end |
#free_variables ⇒ Object
29 30 31 |
# File 'lib/steep/ast/types/boolean.rb', line 29 def free_variables Set.new end |
#hash ⇒ Object
15 16 17 |
# File 'lib/steep/ast/types/boolean.rb', line 15 def hash self.class.hash end |
#level ⇒ Object
33 34 35 |
# File 'lib/steep/ast/types/boolean.rb', line 33 def level [0] end |
#subst(s) ⇒ Object
21 22 23 |
# File 'lib/steep/ast/types/boolean.rb', line 21 def subst(s) self end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/steep/ast/types/boolean.rb', line 25 def to_s "bool" end |
#with_location(new_location) ⇒ Object
37 38 39 |
# File 'lib/steep/ast/types/boolean.rb', line 37 def with_location(new_location) self.class.new(location: new_location) end |