Package wyrl.core

Examples of wyrl.core.Type$Atom


  protected boolean willSkip(Pattern pattern, Type declared) {
    declared = stripNominalsAndRefs(declared);

    if (pattern instanceof Pattern.Leaf) {
      Pattern.Leaf leaf = (Pattern.Leaf) pattern;
      Type element = leaf.type().element();

      if (element == Type.T_ANY() || element.isSubtype(declared)) {
        // In this very special case, we don't need to do anything since
        // we're guarantted to have a match based on the context.
        return true;
      }
    } else if (pattern instanceof Pattern.Term
View Full Code Here


    myOut(1,
        "// =========================================================================");
    myOut();

    for (int i = 0; i != typeRegister.size(); ++i) {
      Type t = typeRegister.get(i);
      JavaIdentifierOutputStream jout = new JavaIdentifierOutputStream();
      BinaryOutputStream bout = new BinaryOutputStream(jout);
      bout.write(t.toBytes());
      bout.flush();
      bout.close();
      // FIXME: strip out nominal types (and any other unneeded types).
      myOut(1, "// " + t);
      myOut(1, "private static Type type" + i + " = Runtime.Type(\""
View Full Code Here

    }
  }

  public int translate(int level, Expr.Cast code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;

    // first translate src expression, and coerce to a value
    int src = translate(level, code.src, environment, file);
    src = coerceFromRef(level, code.src, src, environment);
View Full Code Here

  }

  public int translate(int level, Expr.Constant code,
      Environment environment, SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    Object v = code.value;
    String rhs;

    if (v instanceof Boolean) {
      rhs = v.toString();
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.UnOp code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    int rhs = translate(level, code.mhs, environment, file);
    rhs = coerceFromRef(level, code.mhs, rhs, environment);
    String body;

    switch (code.op) {
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.BinOp code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    Type lhs_t = code.lhs.attribute(Attribute.Type.class).type;
    Type rhs_t = code.rhs.attribute(Attribute.Type.class).type;
    int lhs = translate(level, code.lhs, environment, file);

    String body;

    if (code.op == Expr.BOp.IS && code.rhs instanceof Expr.Constant) {
      // special case for runtime type tests
      Expr.Constant c = (Expr.Constant) code.rhs;
      Type test = (Type) c.value;
      int typeIndex = register(test);
      body = "Runtime.accepts(type" + typeIndex + ", automaton, r" + lhs
          + ", SCHEMA)";
    } else if (code.op == Expr.BOp.AND) {
      // special case to ensure short-circuiting of AND.
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.NaryOp code, Environment environment,
      SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    String body = "new Automaton.";

    if (code.op == Expr.NOp.LISTGEN) {
      body += "List(";
    } else if (code.op == Expr.NOp.BAGGEN) {
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.ListAccess code,
      Environment environment, SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    int src = translate(level, code.src, environment, file);
    int idx = translate(level, code.index, environment, file);
    src = coerceFromRef(level, code.src, src, environment);
    idx = coerceFromRef(level, code.index, idx, environment);
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.ListUpdate code,
      Environment environment, SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    int src = translate(level, code.src, environment, file);
    int idx = translate(level, code.index, environment, file);
    int value = translate(level, code.value, environment, file);

    src = coerceFromRef(level, code.src, src, environment);
View Full Code Here

    return target;
  }

  public int translate(int level, Expr.Constructor code,
      Environment environment, SpecFile file) {
    Type type = code.attribute(Attribute.Type.class).type;
    String body;

    if (code.argument == null) {
      body = code.name;
    } else {
View Full Code Here

TOP

Related Classes of wyrl.core.Type$Atom

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.