Beispiel #1
0
  /**
   * Computes the type of the given list expression.
   *
   * @param expr a list expression
   * @return the type of the given list expression
   */
  public static Type getType(ExprList expr) {
    Iterator<Expression> it = expr.getValue().iterator();
    if (it.hasNext()) {
      Expression subExpr = it.next();
      Type eltLubType = EcoreUtil.copy(subExpr.getType());
      while (it.hasNext()) {
        subExpr = it.next();
        Type t2 = subExpr.getType();
        eltLubType = TypeUtil.getLub(eltLubType, t2);
      }

      return IrFactory.eINSTANCE.createTypeList(expr.getSize(), eltLubType);
    }

    return null;
  }
Beispiel #2
0
 @Override
 public Type getType(Type t1, Type t2) {
   type = TypeUtil.getLub(t1, t2);
   return type;
 }
Beispiel #3
0
 @Override
 public Type getType(Type t1, Type t2) {
   return TypeUtil.getGlb(t1, t2);
 }