Class: Steep::TypeInference::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/type_inference/context.rb

Defined Under Namespace

Classes: BlockContext, BreakContext, MethodContext, ModuleContext

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_context:, block_context:, break_context:, module_context:, self_type:, type_env:) ⇒ Context

Returns a new instance of Context.



81
82
83
84
85
86
87
88
# File 'lib/steep/type_inference/context.rb', line 81

def initialize(method_context:, block_context:, break_context:, module_context:, self_type:, type_env:)
  @method_context = method_context
  @block_context = block_context
  @break_context = break_context
  @module_context = module_context
  @self_type = self_type
  @type_env = type_env
end

Instance Attribute Details

#block_contextObject (readonly)

Returns the value of attribute block_context.



75
76
77
# File 'lib/steep/type_inference/context.rb', line 75

def block_context
  @block_context
end

#break_contextObject (readonly)

Returns the value of attribute break_context.



76
77
78
# File 'lib/steep/type_inference/context.rb', line 76

def break_context
  @break_context
end

#method_contextObject (readonly)

Returns the value of attribute method_context.



74
75
76
# File 'lib/steep/type_inference/context.rb', line 74

def method_context
  @method_context
end

#module_contextObject (readonly)

Returns the value of attribute module_context.



77
78
79
# File 'lib/steep/type_inference/context.rb', line 77

def module_context
  @module_context
end

#self_typeObject (readonly)

Returns the value of attribute self_type.



78
79
80
# File 'lib/steep/type_inference/context.rb', line 78

def self_type
  @self_type
end

#type_envObject (readonly)

Returns the value of attribute type_env.



79
80
81
# File 'lib/steep/type_inference/context.rb', line 79

def type_env
  @type_env
end

Instance Method Details

#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) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/steep/type_inference/context.rb', line 90

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)
  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
  )
end