public final class UnionTypeBuilder
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Method and Description |
|---|---|
UnionTypeBuilder |
addAlternate(JSType alternate)
Adds an alternate to the union type under construction.
|
JSType |
build()
Creates a union.
|
static UnionTypeBuilder |
create(JSTypeRegistry registry) |
public static UnionTypeBuilder create(JSTypeRegistry registry)
public UnionTypeBuilder addAlternate(JSType alternate)
Returns this for easy chaining.
TODO(nickreid): This method shouldn't eagerly collapse types. Doing so risks holding onto a nested union if an alternate resolves so a union after being added. We should do use some technique to determine if the builder has become dirty and caching the result of `build()` until then.
public JSType build()
NO_TYPE.Copyright © 2009-2018 Google. All Rights Reserved.