class TypedRb::Model::TmLocalVarAsgn
Attributes
lhs[RW]
rhs[RW]
Public Class Methods
new(lhs, rhs, node)
click to toggle source
ts '#initialize / String
-> Node -> Node -> unit'
Calls superclass method
TypedRb::Model::Expr::new
# File lib/typed/model/tm_local_var_asgn.rb, line 8 def initialize(lhs, rhs, node) super(node) @lhs = lhs @rhs = rhs end
Public Instance Methods
check_type(context)
click to toggle source
# File lib/typed/model/tm_local_var_asgn.rb, line 14 def check_type(context) binding_type = rhs.check_type(context) maybe_binding = context.get_type_for(lhs) if maybe_binding begin if maybe_binding.compatible?(binding_type, :gt) maybe_binding else fail Types::UncomparableTypes.new(maybe_binding, binding_type, node) end rescue Types::UncomparableTypes raise Types::UncomparableTypes.new(maybe_binding, binding_type, node) end else context.add_binding!(lhs, binding_type) binding_type end end