Class: Internal::ByteDecoder::Expression::Infix
- Inherits:
-
Internal::ByteDecoder::Expression
- Object
- Internal::ByteDecoder::Expression
- Internal::ByteDecoder::Expression::Infix
- Defined in:
- lib/decompiler/vm/bytedecoder.rb
Instance Attribute Summary collapse
-
#lhs ⇒ Object
readonly
Returns the value of attribute lhs.
-
#op ⇒ Object
readonly
Returns the value of attribute op.
-
#rhs ⇒ Object
readonly
Returns the value of attribute rhs.
Attributes inherited from Internal::ByteDecoder::Expression
Instance Method Summary collapse
-
#initialize(pc, op, lhs, rhs) ⇒ Infix
constructor
A new instance of Infix.
- #precedence ⇒ Object
- #to_s ⇒ Object
Methods inherited from Internal::ByteDecoder::Expression
Constructor Details
#initialize(pc, op, lhs, rhs) ⇒ Infix
Returns a new instance of Infix.
103 104 105 106 107 108 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 103 def initialize(pc, op, lhs, rhs) super(pc) @op = op @lhs = lhs @rhs = rhs end |
Instance Attribute Details
#lhs ⇒ Object (readonly)
Returns the value of attribute lhs.
100 101 102 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 100 def lhs @lhs end |
#op ⇒ Object (readonly)
Returns the value of attribute op.
99 100 101 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 99 def op @op end |
#rhs ⇒ Object (readonly)
Returns the value of attribute rhs.
101 102 103 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 101 def rhs @rhs end |
Instance Method Details
#precedence ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 114 def precedence case @op when :*, :/, :% return 2 when '+'.intern, '-'.intern return 3 when :<<, :>> return 4 when :>, :>=, :<, :<=, :==, :===, :!= return 5 when :undef return 6 else raise ArgumentError, "Unknown op: #{@op}" end end |
#to_s ⇒ Object
110 111 112 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 110 def to_s return "#{fmt(@lhs)} #{@op} #{fmt(@rhs)}" end |