Examples of UnionType


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

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

        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

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

  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

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

      // 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

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

      // @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

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

      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

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

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

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

  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

Examples of com.redhat.ceylon.compiler.typechecker.model.UnionType

                        } else {
                            ArrayList<ProducedType> cases = new ArrayList<ProducedType>(2);
                            Util.addToUnion(cases, sequencedType);
                            Util.addToUnion(cases, exprType);
                            if (cases.size() > 1) {
                                UnionType ut = new UnionType(that.getUnit());
                                ut.setCaseTypes(cases);
                                sequencedType = ut.getType();
                            } else {
                                sequencedType = cases.get(0);
                            }
                        }
                        if (!opened) {
View Full Code Here

Examples of com.redhat.ceylon.compiler.typechecker.model.UnionType

            subs = node.getUnit().getTupleElementTypes(pt);
            final ProducedType lastType = subs.get(subs.size()-1);
            if (node.getUnit().getSequenceDeclaration().equals(lastType.getDeclaration())
                    || node.getUnit().getSequentialDeclaration().equals(lastType.getDeclaration())) {
                //Non-empty, non-tuple tail; union it with its type parameter
                UnionType utail = new UnionType(node.getUnit());
                utail.setCaseTypes(Arrays.asList(lastType.getTypeArgumentList().get(0), lastType));
                subs.remove(subs.size()-1);
                subs.add(utail.getType());
            }
        } else {
            return false;
        }
        gen.out("',l:[");
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.