Examples of toMaybeFunctionType()


Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    if (type == null || type.isUnknownType()) {
      return "";
    }

    FunctionType funType = type.toMaybeFunctionType();

    if (JSType.isEquivalent(
        type, registry.getNativeType(JSTypeNative.FUNCTION_INSTANCE_TYPE))) {
      return "/** @type {!Function} */\n";
    }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

      FunctionType classType = null;
      String className = null;

      if (constructor != null && constructor.isConstructor()) {
        // Case where the class has been properly declared with @constructor
        classType = constructor.toMaybeFunctionType();
        className = classType.getReferenceName();
      } else {
        // We'll guess it is a constructor even if it didn't have @constructor
        classType = compiler.getTypeRegistry().getNativeFunctionType(
            JSTypeNative.U2U_CONSTRUCTOR_TYPE);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

      JSType rawType = slot.getType();
      if (rawType != null) {
        // Case constructor, get the instance type
        if ((rawType.isConstructor() || rawType.isInterface())
            && rawType.isFunctionType() && rawType.isNominalConstructor()) {
          return rawType.toMaybeFunctionType().getInstanceType();
        }
        // Case enum
        if (rawType.isEnumType()) {
          return rawType.toMaybeEnumType().getElementsType();
        }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

        MemoizedScopeCreator scopeCreator = (MemoizedScopeCreator) creator;
        String newSrc = scriptRoot.getSourceFileName();
        for (Var var : scopeCreator.getAllSymbols()) {
          JSType type = var.getType();
          if (type != null) {
            FunctionType fnType = type.toMaybeFunctionType();
            if (fnType != null
                && newSrc.equals(NodeUtil.getSourceName(fnType.getSource()))) {
              fnType.setSource(null);
            }
          }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

        // We have an assignment of the form "a.b = ...".
        JSType lValueType = lValue.getJSType();
        if (lValueType != null && lValueType.isNominalConstructor()) {
          // If a.b is a constructor, then everything in this function
          // belongs to the "a.b" type.
          return (lValueType.toMaybeFunctionType()).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());
        }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    }

    Preconditions.checkState(rootNode.isFunction());
    JSType nodeType = rootNode.getJSType();
    if (nodeType != null && nodeType.isFunctionType()) {
      return nodeType.toMaybeFunctionType().getTypeOfThis();
    } else {
      return parent.getTypeOfThis();
    }
  }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

        JSType type = n.getJSType();
        if (type == null || type.isUnknownType()) {
          return;
        }

        FunctionType funType = type.toMaybeFunctionType();
        Node paramNode = NodeUtil.getFunctionParameters(n).getFirstChild();
        List<Integer> positionalDisposedParameters = Lists.newArrayList();

        if (jsDocInfo.disposesOf("*")) {
          positionalDisposedParameters.add(DISPOSE_ALL);
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

            // one addressable "this" symbol.
            symbol = propScope.getOwnSlot("this");
            if (symbol == null) {
              JSType rootType = t.getScopeRoot().getJSType();
              FunctionType fnType = rootType == null
                  ? null : rootType.toMaybeFunctionType();
              JSType type = fnType == null
                  ? null : fnType.getTypeOfThis();
              symbol = addSymbol(
                  "this",
                  type,
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    Node retValue = n.getFirstChild();
    if (retValue != null) {
      JSType type = functionScope.getRootNode().getJSType();
      if (type != null) {
        FunctionType fnType = type.toMaybeFunctionType();
        if (fnType != null) {
          inferPropertyTypesToMatchConstraint(
              retValue.getJSType(), fnType.getReturnType());
        }
      }
View Full Code Here

Examples of com.google.javascript.rhino.jstype.JSType.toMaybeFunctionType()

    scope = traverseChildren(n, scope);

    Node left = n.getFirstChild();
    JSType functionType = getJSType(left).restrictByNotNullOrUndefined();
    if (functionType.isFunctionType()) {
      FunctionType fnType = functionType.toMaybeFunctionType();
      n.setJSType(fnType.getReturnType());
      backwardsInferenceFromCallSite(n, fnType);
    } else if (functionType.isEquivalentTo(
        getNativeType(CHECKED_UNKNOWN_TYPE))) {
      n.setJSType(getNativeType(CHECKED_UNKNOWN_TYPE));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.