本文整理汇总了Java中com.google.javascript.rhino.jstype.JSType.isSubtype方法的典型用法代码示例。如果您正苦于以下问题:Java JSType.isSubtype方法的具体用法?Java JSType.isSubtype怎么用?Java JSType.isSubtype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.jstype.JSType
的用法示例。
在下文中一共展示了JSType.isSubtype方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expectAnyObject
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
* Expect the type to contain an object sometimes. If the expectation is
* not met, issue a warning at the provided node's source code position.
*/
void expectAnyObject(NodeTraversal t, Node n, JSType type, String msg) {
JSType anyObjectType = getNativeType(NO_OBJECT_TYPE);
if (!anyObjectType.isSubtype(type)) {
mismatch(t, n, msg, type, anyObjectType);
}
}
示例2: isValidDefineType
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
* Determines whether the given type is a valid {@code @define} type.
*/
// TODO(nicksantos): Move this into a check pass.
private boolean isValidDefineType(Node typeNode) {
JSType type = typeRegistry.createFromTypeNodes(typeNode, "", null);
return !type.isUnknownType() && type.isSubtype(
typeRegistry.getNativeType(JSTypeNative.NUMBER_STRING_BOOLEAN));
}
示例3: caseObjectType
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
public JSType caseObjectType(ObjectType type) {
if (value.equals("function")) {
JSType ctorType = getNativeType(U2U_CONSTRUCTOR_TYPE);
return resultEqualsValue && ctorType.isSubtype(type) ? ctorType : null;
}
return matchesExpectation("object") ? type : null;
}
示例4: expectBitwiseable
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
* Expect the type to be a valid operand to a bitwise operator. This includes
* numbers, any type convertible to a number, or any other primitive type
* (undefined|null|boolean|string).
*/
void expectBitwiseable(NodeTraversal t, Node n, JSType type, String msg) {
if (!type.matchesNumberContext() && !type.isSubtype(allValueTypes)) {
mismatch(t, n, msg, type, allValueTypes);
}
}
示例5: isVoidOrUnknown
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
* @return {@code true} if returnType is void, unknown, or a union
* containing void or unknown
*/
private boolean isVoidOrUnknown(JSType returnType) {
final JSType voidType =
compiler.getTypeRegistry().getNativeType(JSTypeNative.VOID_TYPE);
return voidType.isSubtype(returnType);
}
示例6: caseObjectType
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
@Override
public JSType caseObjectType(ObjectType type) {
JSType arrayType = getNativeType(ARRAY_TYPE);
return arrayType.isSubtype(type) ? arrayType : null;
}
示例7: isAddedAsNumber
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
private boolean isAddedAsNumber(JSType type) {
return type.isSubtype(registry.createUnionType(VOID_TYPE, NULL_TYPE,
NUMBER_VALUE_OR_OBJECT_TYPE, BOOLEAN_TYPE, BOOLEAN_OBJECT_TYPE));
}