Class: SystemNavigation::InstructionStream::Instruction::AttrWriterInstruction

Inherits:
AttrInstruction show all
Defined in:
lib/system_navigation/instruction_stream/instruction/attr_instruction.rb

Overview

Since:

  • 0.1.0

Instance Attribute Summary

Attributes inherited from AttrInstruction

#method, #visitor

Instance Method Summary collapse

Methods inherited from AttrInstruction

#accept, attrreaderinstr, attrwriterinstr, parse, #parse

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, parse, #parse_cvar, #parse_gvar, #parse_ivar, #parse_lineno, #parse_op_id, #parse_opcode, #parse_operand, #parse_position, #parse_service_instruction, #parse_var, #putnils?, #putstrings?, #reads_cvar?, #reads_gvar?, #sends_msg?, #vm_operative?, #writes_cvar?, #writes_gvar?

Constructor Details

#initialize(sym) ⇒ AttrWriterInstruction

Returns a new instance of AttrWriterInstruction.

Since:

  • 0.1.0



65
66
67
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 65

def initialize(sym)
  @sym = sym
end

Instance Method Details

#putobjects?(sym) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0



84
85
86
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 84

def putobjects?(sym)
  @sym == sym
end

#reads_ivar?(_sym) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0



76
77
78
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 76

def reads_ivar?(_sym)
  false
end

#visit(obj) ⇒ Object

Since:

  • 0.1.0



69
70
71
72
73
74
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 69

def visit(obj)
  name = obj.method.original_name.to_s
  matched = (name[-1] == '=') && (name[0..-2] == convert_accessor_to_name(@sym))
  obj.visitor = self if matched
  matched
end

#writes_ivar?(_sym) ⇒ Boolean

Returns:

  • (Boolean)

Since:

  • 0.1.0



80
81
82
# File 'lib/system_navigation/instruction_stream/instruction/attr_instruction.rb', line 80

def writes_ivar?(_sym)
  true
end