Class: Delorean::BinOp

Inherits:
SNode
  • Object
show all
Defined in:
lib/delorean/nodes.rb

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



183
184
185
186
187
# File 'lib/delorean/nodes.rb', line 183

def check(context, *)
  vc, ec = v.check(context), e.check(context)
  # returns list of attrs used in RHS and LHS
  ec + vc
end

#rewrite(context) ⇒ Object



189
190
191
192
193
194
195
# File 'lib/delorean/nodes.rb', line 189

def rewrite(context)
  if op.text_value.start_with? 'in'
    "(#{e.rewrite(context)}).member?( #{v.rewrite(context)} )"
  else
    v.rewrite(context) + " #{op.text_value} " + e.rewrite(context)
  end
end