History

My first initial commit with all of mine experimental changes.

Dmitry Kabak (userdima committed 13 years ago

Commit d37b88d1 parent 3f5b46618352 files · +2598093 −-8690Browse files

Showing the changes to java/pkg/sun/tools/tree/ExprExpression.java (1 of 18352 files). Show all

Unified · Split

java/pkg/sun/tools/tree/ExprExpression.java+126−0
@@ -0,0 +1,126 @@
1+/*
2+ * Copyright (c) 1994, 2003, Oracle and/or its affiliates. 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. Oracle designates this
8+ * particular file as subject to the "Classpath" exception as provided
9+ * by Oracle 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22+ * or visit www.oracle.com if you need additional information or have any
23+ * questions.
24+ */
25+
26+package sun.tools.tree;
27+
28+import sun.tools.java.*;
29+import 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+
39+public
40+class 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+}