当前位置: 首页>>代码示例>>Java>>正文


Java ObjectType.isUnknownType方法代码示例

本文整理汇总了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;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:21,代码来源:AmbiguateProperties.java

示例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;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:42,代码来源:TypedScopeCreator.java

示例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;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:35,代码来源:TightenTypes.java


注:本文中的com.google.javascript.rhino.jstype.ObjectType.isUnknownType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。