Class: Internal::ByteDecoder::Expression

Inherits:
Object
  • Object
show all
Defined in:
lib/decompiler/vm/bytedecoder.rb

Defined Under Namespace

Classes: Array, Assignment, ConcatArray, ConcatStrings, Constant, ConstantAssignment, Defined, Hash, Infix, Literal, Prefix, Self, Send, Throw, ToRegexp, Variable

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pc) ⇒ Expression

Returns a new instance of Expression.



56
57
58
# File 'lib/decompiler/vm/bytedecoder.rb', line 56

def initialize(pc)
  @pc = pc
end

Instance Attribute Details

#pcObject (readonly)

Returns the value of attribute pc.



54
55
56
# File 'lib/decompiler/vm/bytedecoder.rb', line 54

def pc
  @pc
end

Instance Method Details

#<=>(rhs) ⇒ Object



60
61
62
# File 'lib/decompiler/vm/bytedecoder.rb', line 60

def <=>(rhs)
  return @pc <=> rhs.pc
end

#fmt(arg) ⇒ Object



64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/decompiler/vm/bytedecoder.rb', line 64

def fmt(arg)
  if arg.respond_to?(:precedence)
    p = arg.precedence
  else
    p = 0
  end

  if p >= self.precedence then
    return "(#{arg})"
  else
    return arg
  end
end