Exemple #1
0
 public void setAttr(State s, @NotNull Type v) {
   Type targetType = transformExpr(target, s);
   if (targetType.isUnionType()) {
     Set<Type> types = targetType.asUnionType().types;
     for (Type tp : types) {
       setAttrType(tp, v);
     }
   } else {
     setAttrType(targetType, v);
   }
 }
Exemple #2
0
  @NotNull
  @Override
  public Type transform(State s) {
    // the form of ::A in ruby
    if (target == null) {
      return transformExpr(attr, s);
    }

    Type targetType = transformExpr(target, s);
    if (targetType.isUnionType()) {
      Set<Type> types = targetType.asUnionType().types;
      Type retType = Type.UNKNOWN;
      for (Type tt : types) {
        retType = UnionType.union(retType, getAttrType(tt));
      }
      return retType;
    } else {
      return getAttrType(targetType);
    }
  }