Class: Vernacular::AST::Modifiers::TypedMethodReturns
- Inherits:
-
Vernacular::ASTModifier
- Object
- Vernacular::AST::Modifiers::TypedMethodReturns
- Defined in:
- lib/vernacular/ast/modifiers/typed_method_returns.rb
Overview
Extends Ruby syntax to allow typed method return declarations, as in:
def my_method(argument_a, argument_b) = return_type; end
Defined Under Namespace
Modules: TypedMethodReturnsRewriter
Instance Method Summary collapse
-
#initialize ⇒ TypedMethodReturns
constructor
A new instance of TypedMethodReturns.
Constructor Details
#initialize ⇒ TypedMethodReturns
Returns a new instance of TypedMethodReturns.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/vernacular/ast/modifiers/typed_method_returns.rb', line 9 def initialize super extend_parser(:f_arglist, 'f_arglist tEQL cpath', <<~PARSE) result = @builder.type_check_arglist(*val) PARSE extend_builder(:type_check_arglist) do |arglist, equal, cpath| arglist << n(:type_check_arglist, [equal, cpath], nil) end build_rewriter { include TypedMethodReturnsRewriter } end |