blob: 2c0e2b9626bf8c39f59f43cc97038c16b0e49020 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 1994-2003 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
25
26package sun.tools.tree;
27
28import sun.tools.java.*;
29import java.util.Hashtable;
30
31/**
32 * Parenthesised expressions.
33 *
34 * WARNING: The contents of this source file are not part of any
35 * supported API. Code that depends on them does so at its own risk:
36 * they are subject to change or removal without notice.
37 */
38
39public
40class ExprExpression extends UnaryExpression {
41 /**
42 * Constructor
43 */
44 public ExprExpression(long where, Expression right) {
45 super(EXPR, where, right.type, right);
46 }
47
48 /**
49 * Check a condition. We must pass it on to our unparenthesised form.
50 */
51 public void checkCondition(Environment env, Context ctx, Vset vset,
52 Hashtable exp, ConditionVars cvars) {
53 right.checkCondition(env, ctx, vset, exp, cvars);
54 type = right.type;
55 }
56
57 /**
58 * Check the expression if it appears as an lvalue.
59 * We just pass it on to our unparenthesized subexpression.
60 * (Part of fix for 4090372)
61 */
62 public Vset checkAssignOp(Environment env, Context ctx,
63 Vset vset, Hashtable exp, Expression outside) {
64 vset = right.checkAssignOp(env, ctx, vset, exp, outside);
65 type = right.type;
66 return vset;
67 }
68
69 /**
70 * Delegate to our subexpression.
71 * (Part of fix for 4090372)
72 */
73 public FieldUpdater getUpdater(Environment env, Context ctx) {
74 return right.getUpdater(env, ctx);
75 }
76
77 // Allow (x) = 9;
78 //
79 // I will hold off on this until I'm sure about it. Nobody's
80 // going to clammer for this one.
81 //
82 // public Vset checkLHS(Environment env, Context ctx,
83 // Vset vset, Hashtable exp) {
84 // vset = right.check(env, ctx, vset, exp);
85 // type = right.type;
86 // return vset;
87 // }
88
89 public boolean isNull() {
90 return right.isNull();
91 }
92
93 public boolean isNonNull() {
94 return right.isNonNull();
95 }
96
97 // Probably not necessary
98 public Object getValue() {
99 return right.getValue();
100 }
101
102 /**
103 * Delegate to our subexpression.
104 * See the comment in AddExpression#inlineValueSB() for
105 * information about this method.
106 */
107 protected StringBuffer inlineValueSB(Environment env,
108 Context ctx,
109 StringBuffer buffer) {
110 return right.inlineValueSB(env, ctx, buffer);
111 }
112
113 /**
114 * Select the type of the expression
115 */
116 void selectType(Environment env, Context ctx, int tm) {
117 type = right.type;
118 }
119
120 /**
121 * Simplify
122 */
123 Expression simplify() {
124 return right;
125 }
126}