Class: Steep::TypeInference::MethodCall::Base
- Defined in:
- lib/steep/type_inference/method_call.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#receiver_type ⇒ Object
readonly
Returns the value of attribute receiver_type.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(node:, context:, method_name:, receiver_type:, return_type:) ⇒ Base
constructor
A new instance of Base.
- #with_return_type(new_type) ⇒ Object
Constructor Details
#initialize(node:, context:, method_name:, receiver_type:, return_type:) ⇒ Base
Returns a new instance of Base.
87 88 89 90 91 92 93 |
# File 'lib/steep/type_inference/method_call.rb', line 87 def initialize(node:, context:, method_name:, receiver_type:, return_type:) @node = node @context = context @method_name = method_name @receiver_type = receiver_type @return_type = return_type end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
82 83 84 |
# File 'lib/steep/type_inference/method_call.rb', line 82 def context @context end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
83 84 85 |
# File 'lib/steep/type_inference/method_call.rb', line 83 def method_name @method_name end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
81 82 83 |
# File 'lib/steep/type_inference/method_call.rb', line 81 def node @node end |
#receiver_type ⇒ Object (readonly)
Returns the value of attribute receiver_type.
85 86 87 |
# File 'lib/steep/type_inference/method_call.rb', line 85 def receiver_type @receiver_type end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
84 85 86 |
# File 'lib/steep/type_inference/method_call.rb', line 84 def return_type @return_type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
103 104 105 106 107 108 109 110 |
# File 'lib/steep/type_inference/method_call.rb', line 103 def ==(other) other.is_a?(Base) && other.node == node && other.context == context && other.method_name == method_name && other.return_type == return_type && other.receiver_type == receiver_type end |
#hash ⇒ Object
114 115 116 |
# File 'lib/steep/type_inference/method_call.rb', line 114 def hash node.hash ^ context.hash ^ method_name.hash ^ return_type.hash ^ receiver_type.hash end |
#with_return_type(new_type) ⇒ Object
95 96 97 98 99 100 101 |
# File 'lib/steep/type_inference/method_call.rb', line 95 def with_return_type(new_type) dup.tap do |copy| copy.instance_eval do @return_type = new_type end end end |