Class: TypeProf::Core::EscapeBox
- Defined in:
- lib/typeprof/core/graph/box.rb
Instance Attribute Summary collapse
-
#a_ret ⇒ Object
readonly
Returns the value of attribute a_ret.
Attributes inherited from Box
Instance Method Summary collapse
-
#initialize(node, genv, a_ret) ⇒ EscapeBox
constructor
A new instance of EscapeBox.
- #ret ⇒ Object
- #run0(genv, changes) ⇒ Object
- #wrong_return_type(f_ret_show, changes) ⇒ Object
Methods inherited from Box
#destroy, #on_type_added, #on_type_removed, #reuse, #run, #to_s
Constructor Details
#initialize(node, genv, a_ret) ⇒ EscapeBox
Returns a new instance of EscapeBox.
299 300 301 302 |
# File 'lib/typeprof/core/graph/box.rb', line 299 def initialize(node, genv, a_ret) super(node) @a_ret = a_ret.new_vertex(genv, node) end |
Instance Attribute Details
#a_ret ⇒ Object (readonly)
Returns the value of attribute a_ret.
304 305 306 |
# File 'lib/typeprof/core/graph/box.rb', line 304 def a_ret @a_ret end |
Instance Method Details
#ret ⇒ Object
306 |
# File 'lib/typeprof/core/graph/box.rb', line 306 def ret = @a_ret |
#run0(genv, changes) ⇒ Object
308 309 310 |
# File 'lib/typeprof/core/graph/box.rb', line 308 def run0(genv, changes) return end |
#wrong_return_type(f_ret_show, changes) ⇒ Object
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
# File 'lib/typeprof/core/graph/box.rb', line 312 def wrong_return_type(f_ret_show, changes) actual_ty = @a_ret.show return if actual_ty == "untyped" # XXX: too ad-hoc? msg = "expected: #{ f_ret_show }; actual: #{ actual_ty }" case @node when AST::ReturnNode changes.add_diagnostic(:code_range, msg, @node) when AST::DefNode changes.add_diagnostic(:last_stmt_code_range, msg, @node) when AST::NextNode changes.add_diagnostic(:code_range, msg, @node) when AST::CallNode changes.add_diagnostic(:block_last_stmt_code_range, msg, @node) when AST::AttrReaderMetaNode, AST::AttrAccessorMetaNode changes.add_diagnostic(:code_range, msg, @node) else pp @node.class end end |