src/share/classes/sun/tools/tree/AssignOpExpression.java

Print this page




  36  * they are subject to change or removal without notice.
  37  */
  38 public abstract
  39 class AssignOpExpression extends BinaryAssignExpression {
  40     protected Type itype;       // Type of intermediate result, before assigning
  41     final int NOINC = Integer.MAX_VALUE;
  42 
  43     protected FieldUpdater updater = null;   // Used also in 'AssignAddExpression'.
  44 
  45     /**
  46      * Constructor
  47      */
  48     public AssignOpExpression(int op, long where, Expression left, Expression right) {
  49         super(op, where, left, right);
  50     }
  51 
  52     /**
  53      * Select the type
  54      *
  55      */
  56 
  57     final void selectType(Environment env, Context ctx, int tm) {
  58         Type rtype = null;      // special conversion type for RHS
  59         switch(op) {
  60             case ASGADD:
  61                 if (left.type == Type.tString) {
  62                     if (right.type == Type.tVoid) {
  63                         // The type of the right hand side can be
  64                         // anything except void.  Fix for 4119864.
  65                         env.error(where, "incompatible.type",
  66                                   opNames[op], Type.tVoid, Type.tString);
  67                         type = Type.tError;
  68                     } else {
  69                         type = itype = Type.tString;
  70                     }
  71                     return;
  72                 }
  73                 /* Fall through */
  74             case ASGDIV: case ASGMUL: case ASGSUB: case ASGREM:
  75                 if ((tm & TM_DOUBLE) != 0) {
  76                     itype = Type.tDouble;




  36  * they are subject to change or removal without notice.
  37  */
  38 public abstract
  39 class AssignOpExpression extends BinaryAssignExpression {
  40     protected Type itype;       // Type of intermediate result, before assigning
  41     final int NOINC = Integer.MAX_VALUE;
  42 
  43     protected FieldUpdater updater = null;   // Used also in 'AssignAddExpression'.
  44 
  45     /**
  46      * Constructor
  47      */
  48     public AssignOpExpression(int op, long where, Expression left, Expression right) {
  49         super(op, where, left, right);
  50     }
  51 
  52     /**
  53      * Select the type
  54      *
  55      */
  56     @SuppressWarnings("fallthrough")
  57     final void selectType(Environment env, Context ctx, int tm) {
  58         Type rtype = null;      // special conversion type for RHS
  59         switch(op) {
  60             case ASGADD:
  61                 if (left.type == Type.tString) {
  62                     if (right.type == Type.tVoid) {
  63                         // The type of the right hand side can be
  64                         // anything except void.  Fix for 4119864.
  65                         env.error(where, "incompatible.type",
  66                                   opNames[op], Type.tVoid, Type.tString);
  67                         type = Type.tError;
  68                     } else {
  69                         type = itype = Type.tString;
  70                     }
  71                     return;
  72                 }
  73                 /* Fall through */
  74             case ASGDIV: case ASGMUL: case ASGSUB: case ASGREM:
  75                 if ((tm & TM_DOUBLE) != 0) {
  76                     itype = Type.tDouble;