本文整理汇总了Java中com.google.javascript.rhino.jstype.JSType.isInstanceType方法的典型用法代码示例。如果您正苦于以下问题:Java JSType.isInstanceType方法的具体用法?Java JSType.isInstanceType怎么用?Java JSType.isInstanceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.jstype.JSType
的用法示例。
在下文中一共展示了JSType.isInstanceType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: accept
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
private void accept(StaticTypedSlot<JSType> var, boolean isStatic) {
JSType type = var.getType();
if ((type.isInterface() || type.isConstructor())
&& !type.isInstanceType()
&& toFunctionType(type).getSource() != null
&& !isTypeAlias(var)) {
acceptClassOrInterface(toFunctionType(type));
} else if (isModule(type)) {
acceptModule(var);
} else if (isTypedef(var)) {
acceptTypedef(var);
} else if (type.isEnumType()) {
acceptEnumType(toEnumType(type));
} else if (isTypeAlias(var)) {
// We don't process type alias.
// /** @constructor */ function Foo() {};
// /** @const */ var Bar = Foo;
} else {
acceptMember(var, isStatic);
}
}
示例2: getName
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
private String getName(JSType type) {
if (type.isInstanceType()) {
return ((ObjectType) type).getReferenceName();
} else if (type.isNullType()
|| type.isBooleanValueType()
|| type.isNumberValueType()
|| type.isStringValueType()
|| type.isVoidType()) {
return type.toString();
} else {
// Type unchecked at runtime, so we don't care about the sorting order.
return "";
}
}
示例3: createCheckerNode
import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
* Creates a node which evaluates to a checker for the given type (which
* must not be a union). We have checkers for value types, classes and
* interfaces.
*
* @return the checker node or {@code null} if the type is not checked
*/
private Node createCheckerNode(JSType type) {
if (type.isNullType()) {
return jsCode("nullChecker");
} else if (type.isBooleanValueType()
|| type.isNumberValueType()
|| type.isStringValueType()
|| type.isVoidType()) {
return new Node(Token.CALL,
jsCode("valueChecker"),
Node.newString(type.toString()));
} else if (type.isInstanceType()) {
ObjectType objType = (ObjectType) type;
String refName = objType.getReferenceName();
String sourceName =
NodeUtil.getSourceName(objType.getConstructor().getSource());
CompilerInput sourceInput = compiler.getInput(sourceName);
if (sourceInput == null || sourceInput.isExtern()) {
return new Node(Token.CALL,
jsCode("externClassChecker"),
Node.newString(refName));
}
return new Node(Token.CALL,
jsCode(objType.getConstructor().isInterface() ?
"interfaceChecker" : "classChecker"),
Node.newString(refName));
} else {
// We don't check this type (e.g. unknown & all types).
return null;
}
}