Class: TRuby::IR::FunctionType
- Defined in:
- lib/t_ruby/ir.rb
Overview
Function/Proc type ((String, Integer) -> Boolean)
Instance Attribute Summary collapse
-
#param_types ⇒ Object
Returns the value of attribute param_types.
-
#return_type ⇒ Object
Returns the value of attribute return_type.
Attributes inherited from Node
#location, #metadata, #type_info
Instance Method Summary collapse
-
#initialize(return_type:, param_types: [], **opts) ⇒ FunctionType
constructor
A new instance of FunctionType.
- #to_rbs ⇒ Object
- #to_trb ⇒ Object
Methods inherited from Node
#accept, #children, #transform
Constructor Details
#initialize(return_type:, param_types: [], **opts) ⇒ FunctionType
590 591 592 593 594 |
# File 'lib/t_ruby/ir.rb', line 590 def initialize(return_type:, param_types: [], **opts) super(**opts) @param_types = param_types @return_type = return_type end |
Instance Attribute Details
#param_types ⇒ Object
Returns the value of attribute param_types.
588 589 590 |
# File 'lib/t_ruby/ir.rb', line 588 def param_types @param_types end |
#return_type ⇒ Object
Returns the value of attribute return_type.
588 589 590 |
# File 'lib/t_ruby/ir.rb', line 588 def return_type @return_type end |
Instance Method Details
#to_rbs ⇒ Object
596 597 598 599 |
# File 'lib/t_ruby/ir.rb', line 596 def to_rbs params = @param_types.map(&:to_rbs).join(", ") "^(#{params}) -> #{@return_type.to_rbs}" end |
#to_trb ⇒ Object
601 602 603 604 |
# File 'lib/t_ruby/ir.rb', line 601 def to_trb params = @param_types.map(&:to_trb).join(", ") "(#{params}) -> #{@return_type.to_trb}" end |