Class: Furnace::AVM2::ABC::AS3LookupSwitch

Inherits:
Opcode
  • Object
show all
Defined in:
lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb

Constant Summary

Constants inherited from Opcode

Opcode::MAP

Instance Attribute Summary collapse

Attributes inherited from Opcode

#sequence

Instance Method Summary collapse

Methods inherited from Opcode

#ast_type, body, #byte_length, #consumes_context, define_property, #disassemble, #disassemble_parameters, #initialize, mnemonic, #next, #offset, #read, #root, #write

Constructor Details

This class inherits a constructor from Furnace::AVM2::ABC::Opcode

Instance Attribute Details

#case_targetsObject

Returns the value of attribute case_targets.



14
15
16
# File 'lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb', line 14

def case_targets
  @case_targets
end

#default_targetObject

Returns the value of attribute default_target.



14
15
16
# File 'lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb', line 14

def default_target
  @default_target
end

Instance Method Details

#lookup!Object



27
28
29
30
31
32
# File 'lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb', line 27

def lookup!
  body.default_offset = @default_target.offset - offset
  body.case_offsets = @case_targets.map do |case_target|
    case_target.offset - offset
  end
end

#parametersObject



16
17
18
# File 'lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb', line 16

def parameters
  [ @default_target.offset, @case_targets.map(&:offset) ]
end

#resolve!Object



20
21
22
23
24
25
# File 'lib/furnace-avm2/abc/opcodes/control_transfer/as3_lookupswitch.rb', line 20

def resolve!
  @default_target = @sequence.opcode_at(offset + body.default_offset)
  @case_targets = body.case_offsets.map do |case_offset|
    @sequence.opcode_at(offset + case_offset)
  end
end