lib/bmg/operator/shared/binary.rb in bmg-0.16.7 vs lib/bmg/operator/shared/binary.rb in bmg-0.17.0
- old
+ new
@@ -1,17 +1,28 @@
module Bmg
module Operator
module Binary
include Operator
+ def bind(binding)
+ _with_operands(left.bind(binding), right.bind(binding))
+ end
+
protected
- attr_reader :left, :right
+ attr_accessor :left, :right
def _visit(parent, visitor)
visitor.call(self, parent)
left.send(:_visit, self, visitor)
right.send(:_visit, self, visitor)
+ end
+
+ def _with_operands(left, right)
+ dup.tap{|d|
+ d.left = left
+ d.right = right
+ }
end
def operands
[left, right]
end