Class: Nodewrap::ByteDecoder::Expression::Throw

Inherits:
Nodewrap::ByteDecoder::Expression show all
Defined in:
lib/bytedecoder.rb

Instance Attribute Summary

Attributes inherited from Nodewrap::ByteDecoder::Expression

#pc

Instance Method Summary collapse

Methods inherited from Nodewrap::ByteDecoder::Expression

#<=>, #fmt

Constructor Details

#initialize(pc, value) ⇒ Throw

Returns a new instance of Throw.



426
427
428
429
# File 'lib/bytedecoder.rb', line 426

def initialize(pc, value)
  super(pc)
  @value = value
end

Instance Method Details

#precedenceObject



440
441
442
# File 'lib/bytedecoder.rb', line 440

def precedence
  return 1
end

#to_sObject



431
432
433
434
435
436
437
438
# File 'lib/bytedecoder.rb', line 431

def to_s
  # TODO: not all throws are breaks...
  if not @value or (@value.is_a?(Literal) and @value.value == nil) then
    return "break"
  else
    return "break #{@value}"
  end
end