Package com.google.javascript.rhino.jstype

Examples of com.google.javascript.rhino.jstype.UnionType


          shortest = distance;
          bestSoFar = alt;
        }
      }
    } else if (objectType.isUnionType()) {
      UnionType type = (UnionType) objectType;
      for (JSType alt : type.getAlternates()) {
        SuggestionPair pair = getClosestPropertySuggestion(alt, propName);
        if (pair != null) {
          if (pair.distance <= shortest) {
            if (pair.distance  == shortest) {
              if (bestSoFar != null &&
View Full Code Here


        return;
      }

      String className = thisType.getDisplayName();
      if (thatType.isUnionType()) {
        UnionType ut = thatType.toMaybeUnionType();
        for (JSType type : ut.getAlternates()) {
          if (type.isObject()) {
            addEventizeClass(className, type);
          }
        }
      } else {
View Full Code Here

  public List<Symbol> getAllSymbolsForType(JSType type) {
    if (type == null) {
      return ImmutableList.of();
    }

    UnionType unionType = type.toMaybeUnionType();
    if (unionType != null) {
      List<Symbol> result = Lists.newArrayListWithExpectedSize(2);
      for (JSType alt : unionType.getAlternates()) {
        // Our type system never has nested unions.
        Symbol altSym = getSymbolForTypeHelper(alt, true);
        if (altSym != null) {
          result.add(altSym);
        }
View Full Code Here

      // Filter out non-function types (such as null and undefined) as
      // we only care about FUNCTION subtypes here.
      FunctionType restrictedParameter = null;
      if (iParameterType.isUnionType()) {
        UnionType union = iParameterType.toMaybeUnionType();
        for (JSType alternative : union.getAlternates()) {
          if (alternative.isFunctionType()) {
            // There is only one function type per union.
            restrictedParameter = alternative.toMaybeFunctionType();
            break;
          }
View Full Code Here

      // @param {T}
      resolvedTemplateType(
          resolvedTypes, paramType.toMaybeTemplateType(), argType);
    } else if (paramType.isUnionType()) {
      // @param {Array.<T>|NodeList|Arguments|{length:number}}
      UnionType unionType = paramType.toMaybeUnionType();
      for (JSType alernative : unionType.getAlternates()) {
        maybeResolveTemplatedType(alernative, argType, resolvedTypes, seenTypes);
      }
    } else if (paramType.isFunctionType()) {
      FunctionType paramFunctionType = paramType.toMaybeFunctionType();
      FunctionType argFunctionType = argType
View Full Code Here

      areAllUnknownsChecked = areAllUnknownsChecked &&
          alternate.isCheckedUnknownType();
    }
    if (!isAllType && !isNativeUnknownType) {
      if (alternate.isUnionType()) {
        UnionType union = alternate.toMaybeUnionType();
        for (JSType unionAlt : union.getAlternates()) {
          addAlternate(unionAlt);
        }
      } else {
        if (alternates.size() > maxUnionSize) {
          return this;
View Full Code Here

   */
  JSType build() {
    if (result == null) {
      result = reduceAlternatesWithoutUnion();
      if (result == null) {
        result = new UnionType(registry, getAlternateListCopy());
      }
    }
    return result;
  }
View Full Code Here

  public List<Symbol> getAllSymbolsForType(JSType type) {
    if (type == null) {
      return ImmutableList.of();
    }

    UnionType unionType = type.toMaybeUnionType();
    if (unionType != null) {
      List<Symbol> result = Lists.newArrayListWithExpectedSize(2);
      for (JSType alt : unionType.getAlternates()) {
        // Our type system never has nested unions.
        Symbol altSym = getOnlySymbolForType(alt);
        if (altSym != null) {
          result.add(altSym);
        }
View Full Code Here

TOP

Related Classes of com.google.javascript.rhino.jstype.UnionType

Copyright © 2018 www.massapicom. 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.