Examples of KissException


Examples of kiss.lang.impl.KissException

  }
 
  public static Cast create(Type type, Expression body) {
    Type bt=body.getType();
    if (bt.intersection(type)==Nothing.INSTANCE) {
      throw new KissException("Can't cast type "+bt+" to "+type);
    }
    return new Cast(type,body.specialise(type));
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

  public Environment compute(Environment d, IPersistentMap bindings) {
    Environment ev= body.compute(d, bindings);
    if (ev.isExiting()) return ev;
    Object result=ev.getResult();
    if (type.checkInstance(result)) {
      throw new KissException("Can't cast value of class "+KissUtils.typeName(result)+" to "+type);
     
    }
    return ev;
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

  public Expression optimise() {
    Expression b=body.optimise();
    Type bt=body.getType();
    if (b.isConstant()) {
      Object val=b.eval();
      if (type.checkInstance(val)) throw new KissException("Impossible to cast value "+val+" to type: "+type);
      // TODO: is this logic sound? what about interface casts?
      return b;
    }
    Type t=type;
    if (t.contains(bt)) t=bt;
View Full Code Here

Examples of kiss.lang.impl.KissException

  }
 
  @Override
  public void validate() {
    int n=types.length;
    if (n<2) throw new KissException("Union must have at least two members");
    for (int i=0; i<n; i++) {
      Type t=types[i];
      t.validate();
      if (t instanceof Nothing) throw new KissException(this+ " should not contain Nothing type");
    }
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

    return this;
  }
 
  @Override
  public void validate() {
    if (!type.checkInstance(value)) throw new KissException("Mismatched type!");
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

    return "(Values "+values.toString()+")";
  }
 
  @Override
  public void validate() {
    if (values.count()<=1) throw new KissException("Insufficient values in ValueSet!");
   
    // TODO: class tests?
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

  @Override
  public Environment compute(Environment d, IPersistentMap bindings) {
    d=func.compute(d, bindings);
    Object o=d.getResult();
    if (!(o instanceof IFn)) throw new KissException("Not a function: "+o);
    IFn fn=(IFn)o;
   
    int n=params.length;
    Object[] args=new Object[n];
    for (int i=0; i<n; i++) {
View Full Code Here

Examples of kiss.lang.impl.KissException

    return update(nfunc,nParams);
  }

  @Override
  public void validate() {
    if (params.length!=arity) throw new KissException("Mismatched arity!");
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

    return t;
  }
 
  @Override
  public void validate() {
    if (this!=Nothing.INSTANCE) throw new KissException(this+ " should be a singleton!");
  }
View Full Code Here

Examples of kiss.lang.impl.KissException

    return Union.create(this,t);
  }

  @Override
  public void validate() {
    if (arity!=paramTypes.length) throw new KissException("Mismatched arity count");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.