/** * An all type expression must be of the form: all() */ private boolean validAllTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.ALL); }
/** * An unknown type expression must be of the form: unknown() */ private boolean validUnknownTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.UNKNOWN); }
/** * An unknown type expression must be of the form: unknown() */ private boolean validUnknownTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.UNKNOWN); }
/** * An all type expression must be of the form: all() */ private boolean validAllTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.ALL); }
/** * A none type expression must be of the form: none() */ private boolean validNoneTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.NONE); }
/** * A none type expression must be of the form: none() */ private boolean validNoneTypeExpression(Node expr) { // The expression must have no children return checkParameterCount(expr, Keywords.NONE); }
/** * A typeOfVar expression must be of the form instanceOf('name') */ private boolean validInstanceOfExpression(Node expr) { // The expression must have two children: // - The instanceOf keyword // - A string if (!checkParameterCount(expr, Keywords.INSTANCEOF)) { return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.INSTANCEOF.name, expr); return false; } return true; }
/** * A raw type expression must be of the form rawTypeOf(TTLExp) */ private boolean validRawTypeOfTypeExpression(Node expr) { // The expression must have two children. The rawTypeOf keyword and the // parameter if (!checkParameterCount(expr, Keywords.RAWTYPEOF)) { return false; } // The parameter must be a valid type expression if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.RAWTYPEOF.name, expr); return false; } return true; }
/** * A raw type expression must be of the form rawTypeOf(TTLExp) */ private boolean validRawTypeOfTypeExpression(Node expr) { // The expression must have two children. The rawTypeOf keyword and the // parameter if (!checkParameterCount(expr, Keywords.RAWTYPEOF)) { return false; } // The parameter must be a valid type expression if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.RAWTYPEOF.name, expr); return false; } return true; }
/** * A typeOfVar expression must be of the form instanceOf('name') */ private boolean validInstanceOfExpression(Node expr) { // The expression must have two children: // - The instanceOf keyword // - A string if (!checkParameterCount(expr, Keywords.INSTANCEOF)) { return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.INSTANCEOF.name, expr); return false; } return true; }
/** * A typeOfVar expression must be of the form typeOfVar('name') */ private boolean validTypeOfVarExpression(Node expr) { // The expression must have two children: // - The typeOfVar keyword // - A string if (!checkParameterCount(expr, Keywords.TYPEOFVAR)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("name", expr); warnInvalidInside(Keywords.TYPEOFVAR.name, expr); return false; } return true; }
/** * A record type expression must be of the form: * record(RecordExp, RecordExp, ...) */ private boolean validRecordTypeExpression(Node expr) { // The expression must have at least two children. The record keyword and // a record expression if (!checkParameterCount(expr, Keywords.RECORD)) { return false; } // Each child must be a valid record for (int i = 0; i < getCallParamCount(expr); i++) { if (!validRecordParam(getCallArgument(expr, i))) { warnInvalidInside(Keywords.RECORD.name, expr); return false; } } return true; }
/** * A typeOfVar expression must be of the form typeOfVar('name') */ private boolean validTypeOfVarExpression(Node expr) { // The expression must have two children: // - The typeOfVar keyword // - A string if (!checkParameterCount(expr, Keywords.TYPEOFVAR)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("name", expr); warnInvalidInside(Keywords.TYPEOFVAR.name, expr); return false; } return true; }
/** * A record type expression must be of the form: * record(RecordExp, RecordExp, ...) */ private boolean validRecordTypeExpression(Node expr) { // The expression must have at least two children. The record keyword and // a record expression if (!checkParameterCount(expr, Keywords.RECORD)) { return false; } // Each child must be a valid record for (int i = 0; i < getCallParamCount(expr); i++) { if (!validRecordParam(getCallArgument(expr, i))) { warnInvalidInside(Keywords.RECORD.name, expr); return false; } } return true; }
private boolean validPrintTypeExpression(Node expr) { // The expression must have three children. The printType keyword, a // message and a type transformation expression if (!checkParameterCount(expr, Keywords.PRINTTYPE)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("message", expr); warnInvalidInside(Keywords.PRINTTYPE.name, expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside(Keywords.PRINTTYPE.name, expr); return false; } return true; }
private boolean validPropTypeExpression(Node expr) { // The expression must have three children. The propType keyword, a // a string and a type transformation expression if (!checkParameterCount(expr, Keywords.PROPTYPE)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("property name", expr); warnInvalidInside(Keywords.PROPTYPE.name, expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside(Keywords.PROPTYPE.name, expr); return false; } return true; }
private boolean validPropTypeExpression(Node expr) { // The expression must have three children. The propType keyword, a // a string and a type transformation expression if (!checkParameterCount(expr, Keywords.PROPTYPE)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("property name", expr); warnInvalidInside(Keywords.PROPTYPE.name, expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside(Keywords.PROPTYPE.name, expr); return false; } return true; }
private boolean validPrintTypeExpression(Node expr) { // The expression must have three children. The printType keyword, a // message and a type transformation expression if (!checkParameterCount(expr, Keywords.PRINTTYPE)) { return false; } if (!getCallArgument(expr, 0).isString()) { warnInvalid("message", expr); warnInvalidInside(Keywords.PRINTTYPE.name, expr); return false; } if (!validTypeTransformationExpression(getCallArgument(expr, 1))) { warnInvalidInside(Keywords.PRINTTYPE.name, expr); return false; } return true; }
private boolean validNativeTypeExpr(Node expr) { // The expression must have two children: // - The typeExpr keyword // - A string if (!checkParameterCount(expr, Keywords.TYPEEXPR)) { return false; } Node typeString = getCallArgument(expr, 0); if (!typeString.isString()) { warnInvalidExpression("native type", expr); warnInvalidInside(Keywords.TYPEEXPR.name, expr); return false; } Node typeExpr = JsDocInfoParser.parseTypeString(typeString.getString()); typeString.detach(); expr.addChildToBack(typeExpr); return true; }
private boolean validNativeTypeExpr(Node expr) { // The expression must have two children: // - The typeExpr keyword // - A string if (!checkParameterCount(expr, Keywords.TYPEEXPR)) { return false; } Node typeString = getCallArgument(expr, 0); if (!typeString.isString()) { warnInvalidExpression("native type", expr); warnInvalidInside(Keywords.TYPEEXPR.name, expr); return false; } Node typeExpr = JsDocInfoParser.parseTypeString(typeString.getString()); typeString.detachFromParent(); expr.addChildToBack(typeExpr); return true; }