Package org.allspice.structured.expr

Examples of org.allspice.structured.expr.Expr


    }
    Iterator<StubResolver> i = types.iterator();
    Iterator<Expr> j = args.iterator();
    while(i.hasNext()) {
      StubResolver param = i.next();
      Expr arg = j.next();
      if (!context.isInstanceOf(param.getTypeName(),arg)) {
        return false ;
      }
    }
    return true;
View Full Code Here


    }
    return vardecls ;

  }
  public static Expr makeFCall(PositionRange range,Expr factor,ImmutableCollection<Expr> elist_opt) {
      final Expr v ;
    if (factor instanceof VarExpr) {
      VarExpr ve = (VarExpr)factor ;
      if (ve.var.equals("this")) {
        v = new FieldVarExpr(ve,"<init>",range) ;
      }
View Full Code Here

  public static FIFO<Statement> createForStatement(PositionRange range,ForInitializer init,Expr term,Expr inc,ImmutableCollection<Statement> statement) {
    ImmutableCollection<Statement> whilebody = statement ;
    if (inc != null) {
      whilebody = whilebody.insert(new ExprStatement(inc,inc.getPositionRange())) ;
    }
    Expr test ;
    if (term == null) {
      test = new ConstExpr(Boolean.TRUE,range) ;
    }
    else {
        test = term ;
    }
    Statement whileState = new WhileStatement(test,whilebody,range) ;
    if (init == null) {
      return new FIFO<Statement>(whileState) ;
    }
    if (init instanceof ExprForInit) {
        Expr e = ((ExprForInit)init).e ;
        return new FIFO<Statement>(
          new ExprStatement(e,e.getPositionRange()),
          whileState) ;
    }
    ImmutableCollection<VarDecl> vardecls = ((DeclarationForInit)init).vardecls ;
    return new FIFO<Statement>(new DeclareStatement(
      vardecls,
View Full Code Here

    Iterator<Statement> i = body.iterator() ;
    if (i.hasNext()) {
      Statement st = i.next() ;
      if (st instanceof ExprStatement) {
        ExprStatement es = (ExprStatement)st ;
        Expr e = es.e ;
        if (e instanceof CallExpr) {
          CallExpr ce = (CallExpr)e ;
          Expr ve = ce.object ;
          if (ve instanceof FieldVarExpr) {
            FieldVarExpr fvar = (FieldVarExpr)ve ;
            if (fvar.name.equals("<init>")) {
              return true ;
            }
View Full Code Here

    return mdef ;
  }

  public static FieldDef getDef(StdJavaExpressions converter,ClassPool classPool,ClassDecl classDecl,FieldDecl fdecl,FileUnitInfo fuinfo) throws CompilerException {
    ConstObj o ;
    Expr init = fdecl.intializer ;
    final FieldAttrs fieldAttrs = fdecl.fieldAttrs;
    if (init != null && fieldAttrs.isFinal) {
      StubResolver stub = classPool.new SimpleResolver(ClassPool.getClassName(fuinfo.unit,classDecl)) ;
      EvaluationContext context = new EvaluationContext(converter,classPool,fuinfo.unit,stub) ;
      o = context.getConst(init) ;   
View Full Code Here

public abstract class InBinopPlaceOp<T extends InPlaceExpr<Expr,Expr>> extends InPlaceOp<T> {
  public abstract Inst createOp(StubResolver tc) ;
  @Override
  public void compileLValueNoReturn(T t, EvaluationContext context, InstList l) throws CompilerException {
    final Expr var = t.lhs;
    final Expr inc = t.rhs;
    final Inst type = createOp(context.getType(var));
    StdJavaExpressions.createInPlaceNoReturn(context, inc, var, type,l);
  }
View Full Code Here

    final Expr inc = t.rhs;
    final Inst type = createOp(context.getType(var));
    StdJavaExpressions.createInPlaceNoReturn(context, inc, var, type,l);
  }
  public org.allspice.bytecode.LValue compileLValue(T t, EvaluationContext context, InstList l) throws CompilerException {
    final Expr var = t.lhs;
    final Expr inc = t.rhs;
    final Inst type = createOp(context.getType(var));
    return StdJavaExpressions.createInPlace(context, inc, var, type,l);
  }
View Full Code Here

public abstract class ComparisonOp<T extends BinopExpr<Expr,Expr>> extends Binop<T> {
  public abstract Boolean testCompare(Integer cmp) ;
  public abstract Inst createOp(TypeCode tc,Mark isTrue) ;
    public abstract TypeCode getComparisonType(EvaluationContext context,Expr lhs,Expr rhs) throws CompilerException ;
  public void compile(TypeName forwardType, T t, EvaluationContext context, InstList result) throws CompilerException {
    final Expr lhs = t.lhs;
    final Expr rhs = t.rhs;
    TypeCode type = getComparisonType(context,lhs, rhs) ;
    Mark isTrue = new Mark() ;
    StdJavaExpressions.createBinopComparison(context, lhs, rhs,TypeName.valueOf(type),isTrue,createOp(type,isTrue),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
View Full Code Here

import org.allspice.util.PositionRange;

public abstract class ShiftOp<T extends BinopExpr<Expr,Expr>> extends Binop<T> {
  public abstract Inst createOp(TypeCode tc) ;
  public void compile(TypeName forwardType, T t, EvaluationContext context, InstList result) throws CompilerException {
    final Expr lhs = t.lhs;
    final Expr rhs = t.rhs;
    TypeCode type = StdJavaExpressions.getShiftBinopType(context.getTypeCode(lhs), context.getTypeCode(rhs)) ;
    StdJavaExpressions.createShift(context, lhs, rhs,TypeName.valueOf(type),createOp(type),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
View Full Code Here

    IdentityHashMap<CaseStatement, Mark> marks = new IdentityHashMap<CaseStatement, Mark>() ;
    for(Statement s: statements) {
      if (s instanceof CaseStatement) {
        Mark mark = new Mark() ;
        CaseStatement cs = (CaseStatement)s ;
        final Expr e = cs.e;
        if (e == null) {
          labels.add(new CaseLabel(null,mark)) ;
          deffound = true ;
        }
        else {
View Full Code Here

TOP

Related Classes of org.allspice.structured.expr.Expr

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.