private boolean isOperationKind(String name, OperationKind kind) { return isValidKeyword(name) && nameToKeyword(name).kind == kind; }
private boolean isOperationKind(String name, OperationKind kind) { return isValidKeyword(name) && nameToKeyword(name).kind == kind; }
/** * Checks the structure of the AST of a type transformation expression * in @template T := TTLExp =: */ private boolean validTypeTransformationExpression(Node expr) { if (!isValidExpression(expr)) { warnInvalidExpression("type transformation", expr); return false; } if (isTypeVar(expr) || isTypeName(expr)) { return true; } // Check for valid keyword String name = getCallName(expr); if (!isValidKeyword(name)) { warnInvalidExpression("type transformation", expr); return false; } Keywords keyword = nameToKeyword(name); // Check the rest of the expression depending on the kind switch (keyword.kind) { case TYPE_CONSTRUCTOR: return validTypeExpression(expr); case OPERATION: return validOperationExpression(expr); default: throw new IllegalStateException("Invalid type transformation expression"); } } }
/** * Checks the structure of the AST of a type transformation expression * in @template T := TTLExp =: */ private boolean validTypeTransformationExpression(Node expr) { if (!isValidExpression(expr)) { warnInvalidExpression("type transformation", expr); return false; } if (isTypeVar(expr) || isTypeName(expr)) { return true; } // Check for valid keyword String name = getCallName(expr); if (!isValidKeyword(name)) { warnInvalidExpression("type transformation", expr); return false; } Keywords keyword = nameToKeyword(name); // Check the rest of the expression depending on the kind switch (keyword.kind) { case TYPE_CONSTRUCTOR: return validTypeExpression(expr); case OPERATION: return validOperationExpression(expr); default: throw new IllegalStateException("Invalid type transformation expression"); } } }