Beispiel #1
0
 // Meet two types, location agnostic
 public static JSType meet(JSType lhs, JSType rhs) {
   if (lhs.isTop()) {
     return rhs;
   } else if (rhs.isTop()) {
     return lhs;
   } else if (lhs.isUnknown()) {
     return rhs;
   } else if (rhs.isUnknown()) {
     return lhs;
   }
   int newMask = lhs.mask & rhs.mask;
   String newTypevar;
   if (Objects.equal(lhs.typeVar, rhs.typeVar)) {
     newTypevar = lhs.typeVar;
   } else {
     newTypevar = null;
     newMask = newMask & ~TYPEVAR_MASK;
   }
   return new JSType(newMask, null, ObjectType.meetSets(lhs.objs, rhs.objs), newTypevar);
 }