Class: Delorean::BinOp

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

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



247
248
249
250
251
252
# File 'lib/delorean/nodes.rb', line 247

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

#rewrite(context) ⇒ Object



254
255
256
257
258
259
260
# File 'lib/delorean/nodes.rb', line 254

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