Class: SorobanRustBackend::InstructionHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/instruction_handler.rb

Overview

This class is responsible for generating Rust code for a single instruction.

Instance Method Summary collapse

Constructor Details

#initialize(instruction, metadata) ⇒ InstructionHandler

Returns a new instance of InstructionHandler.



4
5
6
7
# File 'lib/instruction_handler.rb', line 4

def initialize(instruction, )
  @instruction = instruction
   = 
end

Instance Method Details

#generate_rustObject



9
10
11
12
13
14
15
# File 'lib/instruction_handler.rb', line 9

def generate_rust
  unless EXPRESSION_FOOBAR.key?(@instruction.instruction.strip)
    raise "Unknown instruction type: #{@instruction.instruction}"
  end

  EXPRESSION_FOOBAR[@instruction.instruction.strip].send(:handle, @instruction, )
end