Class: SystemNavigation::InstructionStream::Instruction::AttrInstruction

Inherits:
SystemNavigation::InstructionStream::Instruction show all
Defined in:
lib/system_navigation/instruction_stream/instruction/attr_instruction.rb

Overview

Since:

  • 0.1.0

Direct Known Subclasses

AttrReaderInstruction, AttrWriterInstruction

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SystemNavigation::InstructionStream::Instruction

#accessing_cvar?, #accessing_gvar?, #accessing_ivar?, #duparrays?, #dynamically_reads_ivar?, #dynamically_writes_ivar?, #evaling_str, #evals?, #find_message, #parse_cvar, #parse_gvar, #parse_ivar, #parse_lineno, #parse_op_id, #parse_opcode, #parse_operand, #parse_position, #parse_service_instruction, #parse_var, #putnils?, #putobjects?, #putstrings?, #reads_cvar?, #reads_gvar?, #reads_ivar?, #sends_msg?, #vm_operative?, #writes_cvar?, #writes_gvar?, #writes_ivar?

Constructor Details

#initialize(method) ⇒ AttrInstruction

Returns a new instance of AttrInstruction.

Since:

  • 0.1.0



21
22
23
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 21

def initialize(method)
  @method = method
end

Instance Attribute Details

#methodObject (readonly)

Since:

  • 0.1.0



19
20
21
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 19

def method
  @method
end

#visitorObject

Since:

  • 0.1.0



18
19
20
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 18

def visitor
  @visitor
end

Class Method Details

.attrreaderinstr(instr, sym) ⇒ Object

Since:

  • 0.1.0



10
11
12
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 10

def self.attrreaderinstr(instr, sym)
  instr.accept(AttrReaderInstruction.new(sym)) && instr.parse
end

.attrwriterinstr(instr, sym) ⇒ Object

Since:

  • 0.1.0



14
15
16
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 14

def self.attrwriterinstr(instr, sym)
  instr.accept(AttrWriterInstruction.new(sym)) && instr.parse
end

.parse(method, sym) ⇒ Object

Since:

  • 0.1.0



5
6
7
8
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 5

def self.parse(method, sym)
  instr = self.new(method)
  self.attrreaderinstr(instr, sym) || self.attrwriterinstr(instr, sym)
end

Instance Method Details

#accept(visitor) ⇒ Object

Since:

  • 0.1.0



25
26
27
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 25

def accept(visitor)
  visitor.visit(self)
end

#parseObject

Since:

  • 0.1.0



29
30
31
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 29

def parse
  [self.visitor]
end