Class: Steep::TypeInference::Context
- Defined in:
- lib/steep/type_inference/context.rb
Defined Under Namespace
Classes: BlockContext, BreakContext, MethodContext, ModuleContext, TypeVariableContext
Instance Attribute Summary collapse
-
#block_context ⇒ Object
readonly
Returns the value of attribute block_context.
-
#break_context ⇒ Object
readonly
Returns the value of attribute break_context.
-
#call_context ⇒ Object
readonly
Returns the value of attribute call_context.
-
#method_context ⇒ Object
readonly
Returns the value of attribute method_context.
-
#module_context ⇒ Object
readonly
Returns the value of attribute module_context.
-
#self_type ⇒ Object
readonly
Returns the value of attribute self_type.
-
#type_env ⇒ Object
readonly
Returns the value of attribute type_env.
-
#variable_context ⇒ Object
readonly
Returns the value of attribute variable_context.
Instance Method Summary collapse
- #env ⇒ Object
- #factory ⇒ Object
-
#initialize(method_context:, block_context:, break_context:, module_context:, self_type:, type_env:, call_context:, variable_context:) ⇒ Context
constructor
A new instance of Context.
- #inspect ⇒ Object
- #with(method_context: self.method_context, block_context: self.block_context, break_context: self.break_context, module_context: self.module_context, self_type: self.self_type, type_env: self.type_env, call_context: self.call_context, variable_context: self.variable_context) ⇒ Object
Constructor Details
#initialize(method_context:, block_context:, break_context:, module_context:, self_type:, type_env:, call_context:, variable_context:) ⇒ Context
Returns a new instance of Context.
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/steep/type_inference/context.rb', line 149 def initialize(method_context:, block_context:, break_context:, module_context:, self_type:, type_env:, call_context:, variable_context:) @method_context = method_context @block_context = block_context @break_context = break_context @module_context = module_context @self_type = self_type @type_env = type_env @call_context = call_context @variable_context = variable_context end |
Instance Attribute Details
#block_context ⇒ Object (readonly)
Returns the value of attribute block_context.
142 143 144 |
# File 'lib/steep/type_inference/context.rb', line 142 def block_context @block_context end |
#break_context ⇒ Object (readonly)
Returns the value of attribute break_context.
143 144 145 |
# File 'lib/steep/type_inference/context.rb', line 143 def break_context @break_context end |
#call_context ⇒ Object (readonly)
Returns the value of attribute call_context.
140 141 142 |
# File 'lib/steep/type_inference/context.rb', line 140 def call_context @call_context end |
#method_context ⇒ Object (readonly)
Returns the value of attribute method_context.
141 142 143 |
# File 'lib/steep/type_inference/context.rb', line 141 def method_context @method_context end |
#module_context ⇒ Object (readonly)
Returns the value of attribute module_context.
144 145 146 |
# File 'lib/steep/type_inference/context.rb', line 144 def module_context @module_context end |
#self_type ⇒ Object (readonly)
Returns the value of attribute self_type.
145 146 147 |
# File 'lib/steep/type_inference/context.rb', line 145 def self_type @self_type end |
#type_env ⇒ Object (readonly)
Returns the value of attribute type_env.
146 147 148 |
# File 'lib/steep/type_inference/context.rb', line 146 def type_env @type_env end |
#variable_context ⇒ Object (readonly)
Returns the value of attribute variable_context.
147 148 149 |
# File 'lib/steep/type_inference/context.rb', line 147 def variable_context @variable_context end |
Instance Method Details
#env ⇒ Object
190 191 192 |
# File 'lib/steep/type_inference/context.rb', line 190 def env factory.env end |
#factory ⇒ Object
186 187 188 |
# File 'lib/steep/type_inference/context.rb', line 186 def factory type_env.constant_env.factory end |
#inspect ⇒ Object
180 181 182 183 184 |
# File 'lib/steep/type_inference/context.rb', line 180 def inspect s = "#<%s:%#018x " % [self.class, object_id] s << instance_variables.map(&:to_s).sort.map {|name| "#{name}=..." }.join(", ") s + ">" end |
#with(method_context: self.method_context, block_context: self.block_context, break_context: self.break_context, module_context: self.module_context, self_type: self.self_type, type_env: self.type_env, call_context: self.call_context, variable_context: self.variable_context) ⇒ Object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/steep/type_inference/context.rb', line 160 def with(method_context: self.method_context, block_context: self.block_context, break_context: self.break_context, module_context: self.module_context, self_type: self.self_type, type_env: self.type_env, call_context: self.call_context, variable_context: self.variable_context) self.class.new( method_context: method_context, block_context: block_context, break_context: break_context, module_context: module_context, self_type: self_type, type_env: type_env, call_context: call_context, variable_context: variable_context ) end |