public void visitBinaryExpression()

in analyzer/src/main/java/com/android/tools/sizereduction/analyzer/model/GroovyGradleParser.java [179:214]


  public void visitBinaryExpression(BinaryExpression binaryExpression) {
    if (!methodCallStack.isEmpty()) {
      MethodCallExpression call = Iterables.getLast(methodCallStack);
      String parent = call.getMethodAsString();
      String parentParent = getParentParent();
      Expression leftExpression = binaryExpression.getLeftExpression();
      Expression rightExpression = binaryExpression.getRightExpression();
      if (rightExpression instanceof ConstantExpression
          && (leftExpression instanceof PropertyExpression
              || leftExpression instanceof VariableExpression)) {
        String value = rightExpression.getText();
        String property = "";
        if (leftExpression instanceof PropertyExpression) {
          Expression leftPropertyExpression = ((PropertyExpression) leftExpression).getProperty();
          if (!(leftPropertyExpression instanceof ConstantExpression)) {
            return;
          }
          property = leftPropertyExpression.getText();
          Expression leftObjectExpression =
              ((PropertyExpression) leftExpression).getObjectExpression();
          parentParent = parent;
          parent = getValidParentString(leftObjectExpression);
          if (leftObjectExpression instanceof PropertyExpression) {
            parentParent =
                getValidParentString(
                    ((PropertyExpression) leftObjectExpression).getObjectExpression());
          }
        } else {
          property = ((VariableExpression) leftExpression).getName();
        }
        checkDslPropertyAssignment(
            property, value, parent, parentParent, binaryExpression.getLineNumber());
      }
    }
    super.visitBinaryExpression(binaryExpression);
  }