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


Java JSType.isConstructor方法代码示例

本文整理汇总了Java中com.google.javascript.rhino.jstype.JSType.isConstructor方法的典型用法代码示例。如果您正苦于以下问题:Java JSType.isConstructor方法的具体用法?Java JSType.isConstructor怎么用?Java JSType.isConstructor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.javascript.rhino.jstype.JSType的用法示例。


在下文中一共展示了JSType.isConstructor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
  }
}
 
开发者ID:google,项目名称:jsinterop-generator,代码行数:23,代码来源:AbstractClosureVisitor.java

示例2: recordStaticNameDefinition

import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
private Name recordStaticNameDefinition(NodeTraversal t, String name,
    JSType type, Node n, Node parent, Node gParent, Node rValue) {
  if (getNamedContainingFunction() != graph.MAIN) {
    // TODO(user): if A.B() defines A.C(), there is a dependence from
    // A.C() -> A.B(). However, this is not important in module code motion
    // and will be ignored (for now).
  }
  if (type.isFunctionType() && type.isConstructor()) {
    return recordClassConstructorOrInterface(
        name, (FunctionType) type, n, parent, parent.getParent(), rValue);
  } else {
    Name symbol = graph.defineNameIfNotExists(name, isExtern);
    symbol.setType(type);
    if (NodeUtil.isAssign(n)) {
      symbol.addAssignmentDeclaration(n);
    } else {
      symbol.addFunctionDeclaration(n);
    }
    return symbol;
  }
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:22,代码来源:NameReferenceGraphConstruction.java

示例3: getClassOfMethod

import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
 * Gets the type of the class that "owns" a method, or null if
 * we know that its un-owned.
 */
private JSType getClassOfMethod(Node n, Node parent) {
  if (parent.getType() == Token.ASSIGN) {
    Node lValue = parent.getFirstChild();
    if (lValue.isQualifiedName()) {
      if (lValue.getType() == Token.GETPROP) {
        // We have an assignment of the form "a.b = ...".
        JSType lValueType = lValue.getJSType();
        if (lValueType != null && lValueType.isConstructor()) {
          // If a.b is a constructor, then everything in this function
          // belongs to the "a.b" type.
          return ((FunctionType) lValueType).getInstanceType();
        } else {
          // If a.b is not a constructor, then treat this as a method
          // of whatever type is on "a".
          return normalizeClassType(lValue.getFirstChild().getJSType());
        }
      } else {
        // We have an assignment of the form "a = ...", so pull the
        // type off the "a".
        return normalizeClassType(lValue.getJSType());
      }
    }
  } else if (NodeUtil.isFunctionDeclaration(n) ||
             parent.getType() == Token.NAME) {
    return normalizeClassType(n.getJSType());
  }

  return null;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:34,代码来源:CheckAccessControls.java

示例4: normalizeClassType

import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
/**
 * Normalize the type of a constructor, its instance, and its prototype
 * all down to the same type (the instance type).
 */
private JSType normalizeClassType(JSType type) {
  if (type == null || type.isUnknownType()) {
    return type;
  } else if (type.isConstructor()) {
    return ((FunctionType) type).getInstanceType();
  } else if (type.isFunctionPrototypeType()) {
    FunctionType owner = ((FunctionPrototypeType) type).getOwnerFunction();
    if (owner.isConstructor()) {
      return owner.getInstanceType();
    }
  }
  return type;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:18,代码来源:CheckAccessControls.java

示例5: bothIntrinsics

import com.google.javascript.rhino.jstype.JSType; //导入方法依赖的package包/类
private boolean bothIntrinsics(JSType rightType, JSType leftType) {
  return (leftType.isConstructor() || leftType.isEnumType()) &&
      (rightType.isConstructor() || rightType.isEnumType());
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:5,代码来源:TypeValidator.java


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