Package org.allspice.bytecode

Examples of org.allspice.bytecode.TypeCode


    }
 
    @Override
    public StubResolver getType(BitNotExpr t, EvaluationContext context)
        throws CompilerException {
      TypeCode td1 = context.getTypeCode(t.e) ;
      return context.makeTypeRef(getBitBinopType(td1,td1)) ;
    }
View Full Code Here


    public ConstObj getConst(BitNotExpr t, EvaluationContext context) throws CompilerException {
      ConstObj o1 = context.getConst(t.e) ;
      if (o1 == null) {
        return null ;
      }
      TypeCode td1 = context.getTypeCode(t.e) ;
      if (td1.equals(TypeCode.LONG)) {
        return new ConstObj(Long.valueOf(~getLongValue(o1).longValue())) ;
      }
      return new ConstObj(Integer.valueOf(~getIntValue(o1).intValue())) ;
    }
View Full Code Here

import org.allspice.structured.expr.Expr;
import org.allspice.util.PositionRange;

public abstract class ArithOp<T extends BinopExpr<Expr,Expr>> extends Binop<T> {
  public StubResolver getType(T t, EvaluationContext context) throws CompilerException {
    TypeCode td1 = context.getTypeCode(t.lhs) ;
    TypeCode td2 = context.getTypeCode(t.rhs) ;
    return context.makeTypeRef(StdJavaExpressions.getArithBinopType(td1, td2)) ;
  }
View Full Code Here

 
  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.getArithBinopType(context.getTypeCode(lhs), context.getTypeCode(rhs)) ;
    StdJavaExpressions.createBinop(context, lhs, rhs,TypeName.valueOf(type),createOp(type),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
View Full Code Here

public abstract class BitOp<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.getBitBinopType(context.getTypeCode(lhs),context.getTypeCode(rhs)) ;
    StdJavaExpressions.createBinop(context, lhs, rhs,TypeName.valueOf(type),createOp(type),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
View Full Code Here

    StdJavaExpressions.createBinop(context, lhs, rhs,TypeName.valueOf(type),createOp(type),result);
    StdJavaExpressions.convertResult(context,t, forwardType, result) ;
  }
 
  public StubResolver getType(T t, EvaluationContext context) throws CompilerException {
    TypeCode td1 = context.getTypeCode(t.lhs) ;
    TypeCode td2 = context.getTypeCode(t.rhs) ;
    return context.makeTypeRef(StdJavaExpressions.getBitBinopType(td1,td2)) ;
  }   
View Full Code Here

      createNegate(context, e,result);
      convertResult(context,t,forwardType,result) ;
    }
 
    public StubResolver getType(NegateExpr t, EvaluationContext context) throws CompilerException {
      TypeCode type = context.getTypeCode(t.e) ;
      return context.makeTypeRef(getArithBinopType(type, type)) ;
    }
View Full Code Here

    public ConstObj getConst(NegateExpr t, EvaluationContext context) throws CompilerException {
      ConstObj o = context.getConst(t.e) ;
      if (o == null) {
        return null ;
      }
      final TypeCode etc = context.getTypeCode(t.e);
      final TypeCode tc = getArithBinopType(etc, etc) ;
      switch(tc) {
      case DOUBLE: return new ConstObj(Double.valueOf(-getDoubleValue(o).doubleValue())) ;
      case FLOAT: return new ConstObj(Float.valueOf(-getFloatValue(o).floatValue())) ;
      case LONG: return new ConstObj(Long.valueOf(-getLongValue(o).longValue())) ;
      case INT: return new ConstObj(Integer.valueOf(-getIntValue(o).intValue())) ;
View Full Code Here

      createPositive(context, e,result);
      convert(context,getType(t,context),forwardType,result) ;
    }
 
    public StubResolver getType(PositiveExpr t, EvaluationContext context) throws CompilerException {
      TypeCode type = context.getTypeCode(t.e) ;
      return context.makeTypeRef(getArithBinopType(type, type)) ;
    }
View Full Code Here

    public ConstObj getConst(PositiveExpr t, EvaluationContext context) throws CompilerException {
      ConstObj o = context.getConst(t.e) ;
      if (o == null) {
        return null ;
      }
      final TypeCode etc = context.getTypeCode(t.e);
      final TypeCode tc = getArithBinopType(etc, etc) ;
      switch(tc) {
      case DOUBLE: return new ConstObj(getDoubleValue(o)) ;
      case FLOAT: return new ConstObj(getFloatValue(o)) ;
      case LONG: return new ConstObj(getLongValue(o)) ;
      case INT: return new ConstObj(getIntValue(o)) ;
View Full Code Here

TOP

Related Classes of org.allspice.bytecode.TypeCode

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.