Class: Internal::ByteDecoder::Expression::Prefix
- Inherits:
-
Internal::ByteDecoder::Expression
- Object
- Internal::ByteDecoder::Expression
- Internal::ByteDecoder::Expression::Prefix
- Defined in:
- lib/decompiler/vm/bytedecoder.rb
Instance Attribute Summary
Attributes inherited from Internal::ByteDecoder::Expression
Instance Method Summary collapse
-
#initialize(pc, op, expr) ⇒ Prefix
constructor
A new instance of Prefix.
- #precedence ⇒ Object
- #to_s ⇒ Object
Methods inherited from Internal::ByteDecoder::Expression
Constructor Details
#initialize(pc, op, expr) ⇒ Prefix
Returns a new instance of Prefix.
133 134 135 136 137 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 133 def initialize(pc, op, expr) super(pc) @op = op @expr = expr end |
Instance Method Details
#precedence ⇒ Object
151 152 153 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 151 def precedence return 1 end |
#to_s ⇒ Object
139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/decompiler/vm/bytedecoder.rb', line 139 def to_s op = @op.to_s op.chop! if op[-1] == ?@ if @op == '!'.intern and @expr.is_a?(Infix) and @expr.op == :== then return "#{@expr.fmt(@expr.lhs)} != #{@expr.fmt(@expr.rhs)}" elsif self.precedence < @expr.precedence then return "#{op}(#{@expr})" else return "#{op}#{@expr}" end end |