Skip to content

Commit

Permalink
Refactor enums to always be a non-null Set, similarly to objs.
Browse files Browse the repository at this point in the history
Also remove a few leftover references to null objs.
-------------
Created by MOE: http://code.google.com/p/moe-java
MOE_MIGRATED_REVID=87995779
  • Loading branch information
blickly committed Mar 7, 2015
1 parent bd3982b commit 55aa491
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 140 deletions.
7 changes: 2 additions & 5 deletions src/com/google/javascript/jscomp/newtypes/EnumType.java
Expand Up @@ -168,9 +168,6 @@ public boolean enumLiteralHasKey(String name) {
}

static boolean hasNonScalar(ImmutableSet<EnumType> enums) {
if (enums == null) {
return false;
}
for (EnumType e : enums) {
if (e.declaredType.hasNonScalar()) {
return true;
Expand All @@ -181,10 +178,10 @@ static boolean hasNonScalar(ImmutableSet<EnumType> enums) {

static ImmutableSet<EnumType> union(
ImmutableSet<EnumType> s1, ImmutableSet<EnumType> s2) {
if (s1 == null) {
if (s1.isEmpty()) {
return s2;
}
if (s2 == null || s1.equals(s2)) {
if (s2.isEmpty() || s1.equals(s2)) {
return s1;
}
return Sets.union(s1, s2).immutableCopy();
Expand Down

0 comments on commit 55aa491

Please sign in to comment.