Package kiss.lang

Examples of kiss.lang.Expression


    }   
  }
 
  @Override
  public Expression specialise(Type type) {
    Expression newBody=body.specialise(type);
    return update(syms,initials,newBody);
  }
View Full Code Here


    Expression[] nis=initials.clone();
    for (int i=0; i<initials.length; i++) {
      nis[i]=initials[i].substitute(bindings);
      bindings=bindings.without(syms[i]);
    }
    Expression nbody=body.substitute(bindings);
    if (nbody==null) return null;
   
    return update(syms,nis,nbody);
  }
View Full Code Here

    return body.getType();
  }

  @Override
  public Expression specialise(Type type) {
    Expression b=body.specialise(type);
    if ((b==body)||(b==null)) return this;
    return update(sym,b);
  }
View Full Code Here

    return s;
  }
 
  @Override
  public Expression substitute(IPersistentMap bindings) {
    Expression nBody=body.substitute(bindings);
    if (nBody==null) return null;
    return update(sym,nBody);
  }
View Full Code Here

    return new If(cond,doThen,doElse);
  }
 
  @Override
  public Expression optimise() {
    Expression cond=this.cond.optimise();
    Expression doThen=this.doThen.optimise();
    Expression doElse=this.doElse.optimise();
    return update(cond,doThen,doElse);
  }
View Full Code Here

    return type;
  }

  @Override
  public Expression specialise(Type type) {
    Expression newThen=doThen.specialise(type);
    Expression newElse=doElse.specialise(type);
    if ((newThen==null)&&(newElse==null)) return null;
    return update(cond,newThen,newElse);
  }
View Full Code Here

    return update(cond,newThen,newElse);
  }
 
  @Override
  public Expression substitute(IPersistentMap bindings) {
    Expression ncond=cond.substitute(bindings);
    if (ncond==null) return null;
    Expression nthen=doThen.substitute(bindings);
    if (nthen==null) return null;
    Expression nelse=doElse.substitute(bindings);
    if (nelse==null) return null;
   
    return update(ncond,nthen,nelse);
  }
View Full Code Here

    return ev;
  }
 
  @Override
  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;
View Full Code Here

TOP

Related Classes of kiss.lang.Expression

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.