Module: Vernacular::AST::Modifiers::TypedMethodReturns::TypedMethodReturnsRewriter

Defined in:
lib/vernacular/ast/modifiers/typed_method_returns.rb

Overview

Methods to be included in the rewriter in order to handle ‘type_check_arglist` nodes.

Instance Method Summary collapse

Instance Method Details

#on_def(method_node) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/vernacular/ast/modifiers/typed_method_returns.rb', line 26

def on_def(method_node)
  type_check_node = type_check_node_from(method_node)
  return super unless type_check_node

  type_node = type_check_node.children[1]
  remove(type_check_node.children[0][1])
  remove(type_node.loc.expression)
  type_check_method(method_node, type_node)

  super
end