Class: Ikra::Symbolic::ReduceInput
- Inherits:
-
SingleInput
- Object
- Input
- SingleInput
- Ikra::Symbolic::ReduceInput
- Defined in:
- lib/symbolic/input.rb,
lib/symbolic/input_visitor.rb,
lib/translator/input_translator.rb,
lib/types/inference/input_inference.rb
Overview
Similar to [SingleInput], but two values are passed to the block.
Instance Attribute Summary
Attributes inherited from Input
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
- #get_parameters(parent_command:, start_eat_params_offset: 0) ⇒ Object
- #translate_input(parent_command:, command_translator:, start_eat_params_offset: 0) ⇒ Object
Methods inherited from SingleInput
Methods inherited from Input
#==, #eql?, #hash, #initialize
Constructor Details
This class inherits a constructor from Ikra::Symbolic::SingleInput
Instance Method Details
#accept(visitor) ⇒ Object
31 32 33 |
# File 'lib/symbolic/input_visitor.rb', line 31 def accept(visitor) visitor.visit_reduce_input(self, pattern: pattern) end |
#get_parameters(parent_command:, start_eat_params_offset: 0) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/types/inference/input_inference.rb', line 18 def get_parameters(parent_command:, start_eat_params_offset: 0) # TODO: Fix type inference (sometimes type has to be expanded) return [ Translator::Variable.new( name: parent_command.block_parameter_names[start_eat_params_offset], type: command.result_type), Translator::Variable.new( name: parent_command.block_parameter_names[start_eat_params_offset + 1], type: command.result_type)] end |
#translate_input(parent_command:, command_translator:, start_eat_params_offset: 0) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/translator/input_translator.rb', line 25 def translate_input(parent_command:, command_translator:, start_eat_params_offset: 0) # Translate input using visitor input_command_translation_result = command_translator.translate_input(self) # TODO: Fix type inference (sometimes type has to be expanded) parameters = [ Translator::Variable.new( name: parent_command.block_parameter_names[start_eat_params_offset], type: input_command_translation_result.result_type), Translator::Variable.new( name: parent_command.block_parameter_names[start_eat_params_offset + 1], type: input_command_translation_result.result_type)] return Translator::InputTranslationResult.new( parameters: parameters, command_translation_result: input_command_translation_result) end |