receiveLogicalOperator method

  1. @override
DartBlockValueTreeBooleanNode receiveLogicalOperator(
  1. DartBlockBooleanOperator operator
)
override

Implementation

@override
DartBlockValueTreeBooleanNode receiveLogicalOperator(
  DartBlockBooleanOperator operator,
) {
  /// If it has no right child, add or replace its operator and return the same
  /// node.
  if (rightChild == null) {
    this.operator = operator;

    return this;
  } else {
    /// Up until (and including) DartBlock 0.0.37, the enabled approach was 1.
    /// Subsequently, the new approach is 2 as it is more natural and what the user would expect to happen.
    ///
    /// 1. The following would wrap the right child in a new NeoValueBooleanOperatorNode.
    /// Example: Given "true && false" and the incoming operator "||", the result is "true && (false ||)"
    // return rightChild!.receiveLogicalOperator(operator);

    ///
    /// 2. The following wraps the current NeoValueBooleanOperatorNode as a whole in a new NeoValueBooleanOperatorNode.
    /// Example: Given "true && false" and the incoming operator "||", the result is "(true && false) ||"
    return super.receiveLogicalOperator(operator);
  }
}