third_party/closure-compiler/src/src/com/google/javascript/rhino/jstype/UnionType.java
/** Create the final set of alternates for either a new union or a union being rebuilt. */
Create the final set of alternates for either a new union or a union being rebuilt.
Create the final set of alternates for either a new union or a union being rebuilt .
private ImmutableList<JSType> buildInternal() {
      checkHasNotBuilt();
      this.hasBuilt = true;
      JSType wildcard = getNativeWildcardType();
      if (wildcard != null) {
        if (containsVoidType) {
          return ImmutableList.of(wildcard, registry.getNativeType(VOID_TYPE));
        } else {
          return ImmutableList.of(wildcard);
        }
      }
      if (alternates.isEmpty()) {
        return ImmutableList.of(registry.getNativeType(NO_TYPE));
      } else if (alternates.size() > maxUnionSize) {
        return ImmutableList.of(registry.getNativeType(UNKNOWN_TYPE));
      } else {
        return ImmutableList.copyOf(alternates);
      }
    }
private ImmutableList < JSType > buildInternal ( ) { checkHasNotBuilt ( ) ; this . hasBuilt = true ; JSType wildcard = getNativeWildcardType ( ) ; if ( wildcard != null ) { if ( containsVoidType ) { return ImmutableList . of ( wildcard , registry . getNativeType ( VOID_TYPE ) ) ; } else { return ImmutableList . of ( wildcard ) ; } } if ( alternates . isEmpty ( ) ) { return ImmutableList . of ( registry . getNativeType ( NO_TYPE ) ) ; } else if ( alternates . size ( ) > maxUnionSize ) { return ImmutableList . of ( registry . getNativeType ( UNKNOWN_TYPE ) ) ; } else { return ImmutableList . copyOf ( alternates ) ; } }
Create the final set of alternates for either a new union or a union being rebuilt.
Create the final set of alternates for either a new union or a union being rebuilt .
// To simplify the typesystem, empty union types are forbidden. Using a single `bottom` // makes it essentially a proxy instead.