1 24 25 package org.aspectj.compiler.base.ast; 26 27 import org.aspectj.compiler.base.JavaCompiler; 28 import org.aspectj.compiler.base.CodeWriter; 29 import java.io.IOException ; 30 import org.aspectj.compiler.base.bcg.CodeBuilder; 31 32 import java.util.*; 33 34 37 public abstract class ConditionalOpExpr extends BinopExpr { 38 39 protected Type discoverType() { 40 if (! (getRand1().getType().isBoolean() && 41 getRand2().getType().isBoolean())) { 42 showOperatorTypeError(op, getRand1().getType(), getRand2().getType()); 43 } 44 return getTypeManager().booleanType; 45 } 46 47 protected Type getLiftType() { 48 if (getRand1().getType().isBoolean() && 49 getRand2().getType().isBoolean()) { 50 return getTypeManager().booleanType; 51 } else { 52 return getTypeManager().anyType; 53 } 54 } 55 56 protected void cgOp(CodeBuilder cb, Type ty) { 59 throw new RuntimeException ("Attempt to generate code for effect op " 60 + getOp()); 61 } 62 63 65 public ConditionalOpExpr(SourceLocation location, Expr _rand1, String _op, Expr _rand2) { 66 super(location, _rand1, _op, _rand2); 67 68 } 69 protected ConditionalOpExpr(SourceLocation source) { 70 super(source); 71 } 72 73 74 public String getDefaultDisplayName() { 75 return "ConditionalOpExpr(op: "+op+")"; 76 } 77 78 } 80 | Popular Tags |