private boolean validBooleanOperation(Node expr) { boolean valid; if (expr.isNot()) { valid = validBooleanExpression(expr.getFirstChild()); } else { valid = validBooleanExpression(expr.getFirstChild()) && validBooleanExpression(expr.getSecondChild()); } if (!valid) { warnInvalidInside("boolean", expr); return false; } return true; }
private boolean validBooleanOperation(Node expr) { boolean valid; if (expr.isNot()) { valid = validBooleanExpression(expr.getFirstChild()); } else { valid = validBooleanExpression(expr.getFirstChild()) && validBooleanExpression(expr.getSecondChild()); } if (!valid) { warnInvalidInside("boolean", expr); return false; } return true; }
/** * A conditional type transformation expression must be of the * form cond(BoolExp, TTLExp, TTLExp) */ private boolean validConditionalExpression(Node expr) { // The expression must have four children: // - The cond keyword // - A boolean expression // - A type transformation expression with the 'if' branch // - A type transformation expression with the 'else' branch if (!checkParameterCount(expr, Keywords.COND)) { return false; } // Check for the validity of the boolean and the expressions if (!validBooleanExpression(getCallArgument(expr, 0))) { warnInvalidInside("conditional", expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside("conditional", expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 2))) { warnInvalidInside("conditional", expr); return false; } return true; }
/** * A conditional type transformation expression must be of the * form cond(BoolExp, TTLExp, TTLExp) */ private boolean validConditionalExpression(Node expr) { // The expression must have four children: // - The cond keyword // - A boolean expression // - A type transformation expression with the 'if' branch // - A type transformation expression with the 'else' branch if (!checkParameterCount(expr, Keywords.COND)) { return false; } // Check for the validity of the boolean and the expressions if (!validBooleanExpression(getCallArgument(expr, 0))) { warnInvalidInside("conditional", expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside("conditional", expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 2))) { warnInvalidInside("conditional", expr); return false; } return true; }