本文整理汇总了Java中com.google.javascript.rhino.jstype.ObjectType.isUnknownType方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectType.isUnknownType方法的具体用法?Java ObjectType.isUnknownType怎么用?Java ObjectType.isUnknownType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.javascript.rhino.jstype.ObjectType
的用法示例。
在下文中一共展示了ObjectType.isUnknownType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInvalidatingType
import com.google.javascript.rhino.jstype.ObjectType; //导入方法依赖的package包/类
/** Returns true if properties on this type should not be renamed. */
private boolean isInvalidatingType(JSType type) {
if (type instanceof UnionType) {
type = type.restrictByNotNullOrUndefined();
if (type instanceof UnionType) {
for (JSType alt : ((UnionType) type).getAlternates()) {
if (isInvalidatingType(alt)) {
return true;
}
}
return false;
}
}
ObjectType objType = ObjectType.cast(type);
return objType == null
|| invalidatingTypes.contains(objType)
|| !objType.hasReferenceName()
|| (objType.isNamedType() && objType.isUnknownType())
|| objType.isEnumType() || objType.autoboxesTo() != null;
}
示例2: createScope
import com.google.javascript.rhino.jstype.ObjectType; //导入方法依赖的package包/类
/**
* Creates a scope with all types declared. Declares newly discovered types
* and type properties in the type registry.
*/
public Scope createScope(Node root, Scope parent) {
// Constructing the global scope is very different than constructing
// inner scopes, because only global scopes can contain named classes that
// show up in the type registry.
Scope newScope = null;
if (parent == null) {
// Find all the classes in the global scope.
newScope = createInitialScope(root);
GlobalScopeBuilder scopeBuilder = new GlobalScopeBuilder(newScope);
NodeTraversal.traverse(compiler, root, scopeBuilder);
scopeBuilder.resolveStubDeclarations();
// Gather the properties in each function that we found in the
// global scope, if that function has a @this type that we can
// build properties on.
for (Node functionNode : scopeBuilder.nonExternFunctions) {
JSType type = functionNode.getJSType();
if (type != null && type instanceof FunctionType) {
FunctionType fnType = (FunctionType) type;
ObjectType fnThisType = fnType.getTypeOfThis();
if (!fnThisType.isUnknownType()) {
NodeTraversal.traverse(compiler, functionNode.getLastChild(),
scopeBuilder.new CollectProperties(fnThisType));
}
}
}
codingConvention.defineDelegateProxyProperties(
typeRegistry, newScope, delegateProxyMap);
} else {
newScope = new Scope(parent, root);
(new LocalScopeBuilder(newScope)).build();
}
typeRegistry.resolveTypesInScope(newScope);
return newScope;
}
示例3: getImplicitActionsFromProp
import com.google.javascript.rhino.jstype.ObjectType; //导入方法依赖的package包/类
private Collection<Action> getImplicitActionsFromProp(
JSType jsType, String prop, Node fnNode) {
List<Action> actions = Lists.newArrayList();
if (jsType instanceof UnionType) {
boolean found = false;
for (JSType alt : ((UnionType) jsType).getAlternates()) {
ObjectType altObj = ObjectType.cast(alt);
if (altObj != null) {
actions.addAll(getImplicitActionsFromPropNonUnion(
altObj, prop, fnNode));
if (altObj.hasProperty(prop)) {
found = true;
}
}
}
if (found) {
return actions;
}
} else {
ObjectType objType = ObjectType.cast(jsType);
if (objType != null &&
!objType.isUnknownType() && objType.hasProperty(prop)) {
return getImplicitActionsFromPropNonUnion(objType, prop, fnNode);
}
}
// If we didn't find a type that has the property, then check if there
// exists a property with this name anywhere in the externs.
Set<ObjectType> types = getTypeRegistry().getTypesWithProperty(prop);
for (ObjectType type : types) {
actions.addAll(getImplicitActionsFromPropNonUnion(type, prop, fnNode));
}
return actions;
}