Пример #1
0
 public Type type(Env<String, Type> env) {
   Type t = op.type(env).deref(env);
   ast.types.Fun funType =
       Type.expect(op.getLineStart(), op.getLineEnd(), ast.types.Fun.class, this, t);
   checkArgTypes(funType, env);
   setType(funType.getRange());
   return getType();
 }
Пример #2
0
  public Type type(Env<String, Type> env) {

    // Check the bindings as through they were established in a letrec...

    env = env.bind("self", selfType(env));
    env = Binding.typeBindingsRec(bindings, env);
    init.type(env);
    name.type(env);
    MessageType[] handlers = new MessageType[arms.length];
    for (int i = 0; i < arms.length; i++) {
      HandlerType handlerType = arms[i].type(env);
      handlers[i] =
          new MessageType(
              handlerType.getLineStart(), handlerType.getLineEnd(), handlerType.getTypes());
    }
    setType(new ast.types.Act(getLineStart(), getLineEnd(), getExportedTypes(env), handlers));
    return getType();
  }