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.
119 120 121 122 123 |
# File 'lib/steep/type_inference/method_call.rb', line 119 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.
116 117 118 |
# File 'lib/steep/type_inference/method_call.rb', line 116 def actual_method_type @actual_method_type end |
#method_decls ⇒ Object (readonly)
Returns the value of attribute method_decls.
117 118 119 |
# File 'lib/steep/type_inference/method_call.rb', line 117 def method_decls @method_decls end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
149 150 151 152 153 154 |
# File 'lib/steep/type_inference/method_call.rb', line 149 def ==(other) super && other.is_a?(Typed) && other.actual_method_type == actual_method_type && other.method_decls == method_decls end |
#hash ⇒ Object
158 159 160 |
# File 'lib/steep/type_inference/method_call.rb', line 158 def hash super ^ actual_method_type.hash ^ method_decls.hash end |
#pure? ⇒ Boolean
125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/steep/type_inference/method_call.rb', line 125 def pure? method_decls.all? do |method_decl| case member = method_decl.method_def.member when RBS::AST::Members::MethodDefinition member.annotations.any? {|annotation| annotation.string == "pure" } when RBS::AST::Members::Attribute # The attribute writer is not pure !method_decl.method_name.method_name.end_with?("=") end end end |
#update(node: self.node, return_type: self.return_type) ⇒ Object
137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/steep/type_inference/method_call.rb', line 137 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 |