Package wyil.lang

Examples of wyil.lang.Type$Record$State


    Type raw = Type.Union(t1.raw(),t2.raw());
    return construct(nominal,raw);
  }

  public static Nominal Negation(Nominal type) {
    Type nominal = Type.Negation(type.nominal());
    Type raw = Type.Negation(type.raw());
    return construct(nominal,raw);
  }
View Full Code Here


    public Nominal element() {
      return construct(nominal.element(),raw.element());
    }

    public Nominal.EffectiveIndexible update(Nominal key, Nominal value) {
      Type n = (Type) nominal.update(key.nominal(), value.nominal());
      Type r = (Type) raw.update(key.raw(), value.raw());
      return (EffectiveIndexible) construct(n,r);
    }
View Full Code Here

    Expr lhs = propagate(bop.lhs, environment, context);
    Expr rhs = propagate(bop.rhs, environment, context);
    bop.lhs = lhs;
    bop.rhs = rhs;

    Type lhsRawType = lhs.result().raw();
    Type rhsRawType = rhs.result().raw();

    switch (op) {
    case IS:
      // this one is slightly more difficult. In the special case that
      // we have a type constant on the right-hand side then we want
View Full Code Here

    Expr lhs = propagate(expr.lhs, environment, context);
    Expr rhs = propagate(expr.rhs, environment, context);
    expr.lhs = lhs;
    expr.rhs = rhs;
    Type lhsRawType = lhs.result().raw();
    Type rhsRawType = rhs.result().raw();

    boolean lhs_set = Type.isSubtype(Type.T_SET_ANY,
        lhsRawType);
    boolean rhs_set = Type.isSubtype(Type.T_SET_ANY,
        rhsRawType);
    boolean lhs_list = Type.isSubtype(Type.T_LIST_ANY,
        lhsRawType);
    boolean rhs_list = Type.isSubtype(Type.T_LIST_ANY,
        rhsRawType);
    boolean lhs_str = Type.isSubtype(Type.T_STRING, lhsRawType);
    boolean rhs_str = Type.isSubtype(Type.T_STRING, rhsRawType);

    Type srcType;

    if (lhs_str || rhs_str) {

      switch (expr.op) {
      case LISTAPPEND:
View Full Code Here

  private Expr propagate(Expr.Cast c, Environment environment, Context context)
      throws IOException {
    c.expr = propagate(c.expr, environment, context);
    c.type = resolveAsType(c.unresolvedType, context);
    Type from = c.expr.result().raw();
    Type to = c.type.raw();
    if (!Type.isExplicitCoerciveSubtype(to, from)) {
      syntaxError(errorMessage(SUBTYPE_ERROR, to, from), context, c);
    }
    return c;
  }
View Full Code Here

  private Expr propagate(Expr.LengthOf expr, Environment environment,
      Context context) throws IOException, ResolveError {
    expr.src = propagate(expr.src, environment, context);
    Nominal srcType = expr.src.result();
    Type rawSrcType = srcType.raw();

    // First, check whether this is still only an abstract access and, in
    // such case, upgrade it to the appropriate access expression.

    if (rawSrcType instanceof Type.EffectiveCollection) {
View Full Code Here

      Type.FunctionOrMethod f2) {
    List<Type> f1_params = f1.params();
    List<Type> f2_params = f2.params();
    if (f1_params.size() == f2_params.size()) {
      for (int i = 0; i != f1_params.size(); ++i) {
        Type f1_param = f1_params.get(i);
        Type f2_param = f2_params.get(i);
        if (!Type.isSubtype(f1_param, f2_param)) {
          return false;
        }
      }
View Full Code Here

    List<Type> f1_params = f1.params();
    List<Type> f2_params = f2.params();
    if (f1_params.size() == f2_params.size()) {
      boolean allEqual = true;
      for (int i = 0; i != f1_params.size(); ++i) {
        Type f1_param = f1_params.get(i);
        Type f2_param = f2_params.get(i);
        if (!Type.isSubtype(f1_param, f2_param)) {
          return false;
        }
        allEqual &= f1_param.equals(f2_param);
      }
View Full Code Here

   *            --- context in which to resolve the type.
   * @return
   * @throws IOException
   */
  public Nominal resolveAsType(SyntacticType type, Context context) {
    Type nominalType = resolveAsType(type, context, true, false);
    Type rawType = resolveAsType(type, context, false, false);
    return Nominal.construct(nominalType, rawType);
  }
View Full Code Here

   * @return
   * @throws IOException
   */
  public Nominal resolveAsUnconstrainedType(SyntacticType type,
      Context context) {
    Type nominalType = resolveAsType(type, context, true, true);
    Type rawType = resolveAsType(type, context, false, true);
    return Nominal.construct(nominalType, rawType);
  }
View Full Code Here

TOP

Related Classes of wyil.lang.Type$Record$State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.