Class: Steep::TypeInference::MethodCall::Typed
- Defined in:
- lib/steep/type_inference/method_call.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#actual_method_type ⇒ Object
readonly
Returns the value of attribute actual_method_type.
-
#method_decls ⇒ Object
readonly
Returns the value of attribute method_decls.
Attributes inherited from Base
#context, #method_name, #node, #receiver_type, #return_type
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(node:, context:, method_name:, receiver_type:, actual_method_type:, method_decls:, return_type:) ⇒ Typed
constructor
A new instance of Typed.
- #pure? ⇒ Boolean
- #update(node: self.node, return_type: self.return_type) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(node:, context:, method_name:, receiver_type:, actual_method_type:, method_decls:, return_type:) ⇒ Typed
Returns a new instance of Typed.
123 124 125 126 127 |
# File 'lib/steep/type_inference/method_call.rb', line 123 def initialize(node:, context:, method_name:, receiver_type:, actual_method_type:, method_decls:, return_type:) super(node: node, context: context, method_name: method_name, receiver_type: receiver_type, return_type: return_type) @actual_method_type = actual_method_type @method_decls = method_decls end |
Instance Attribute Details
#actual_method_type ⇒ Object (readonly)
Returns the value of attribute actual_method_type.
120 121 122 |
# File 'lib/steep/type_inference/method_call.rb', line 120 def actual_method_type @actual_method_type end |
#method_decls ⇒ Object (readonly)
Returns the value of attribute method_decls.
121 122 123 |
# File 'lib/steep/type_inference/method_call.rb', line 121 def method_decls @method_decls end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
155 156 157 158 159 160 |
# File 'lib/steep/type_inference/method_call.rb', line 155 def ==(other) super && other.is_a?(Typed) && other.actual_method_type == actual_method_type && other.method_decls == method_decls end |
#hash ⇒ Object
164 165 166 |
# File 'lib/steep/type_inference/method_call.rb', line 164 def hash super ^ actual_method_type.hash ^ method_decls.hash end |
#pure? ⇒ Boolean
129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/steep/type_inference/method_call.rb', line 129 def pure? method_decls.all? do |method_decl| case method_decl.method_def.member when RBS::AST::Members::Attribute # The attribute writer is not pure !method_decl.method_name.method_name.end_with?("=") else method_decl.method_def.each_annotation.any? do |annotation| annotation.string == "pure" end end end end |
#update(node: self.node, return_type: self.return_type) ⇒ Object
143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/steep/type_inference/method_call.rb', line 143 def update(node: self.node, return_type: self.return_type) _ = self.class.new( node: node, return_type: return_type, context: context, method_name: method_name, receiver_type: receiver_type, actual_method_type: actual_method_type, method_decls: method_decls ) end |