01: /* PopOperator Copyright (C) 1998-2002 Jochen Hoenicke.
02: *
03: * This program is free software; you can redistribute it and/or modify
04: * it under the terms of the GNU Lesser General Public License as published by
05: * the Free Software Foundation; either version 2, or (at your option)
06: * any later version.
07: *
08: * This program is distributed in the hope that it will be useful,
09: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: * GNU General Public License for more details.
12: *
13: * You should have received a copy of the GNU Lesser General Public License
14: * along with this program; see the file COPYING.LESSER. If not, write to
15: * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
16: *
17: * $Id: PopOperator.java,v 2.14.4.2 2002/05/28 17:34:06 hoenicke Exp $
18: */
19:
20: package jode.expr;
21:
22: import jode.type.Type;
23: import jode.decompiler.TabbedPrintWriter;
24:
25: public class PopOperator extends Operator {
26:
27: Type popType;
28:
29: public PopOperator(Type argtype) {
30: super (Type.tVoid, 0);
31: popType = argtype;
32: initOperands(1);
33: }
34:
35: public int getPriority() {
36: return 0;
37: }
38:
39: public void updateSubTypes() {
40: subExpressions[0].setType(Type.tSubType(popType));
41: }
42:
43: public void updateType() {
44: }
45:
46: public int getBreakPenalty() {
47: if (subExpressions[0] instanceof Operator)
48: return ((Operator) subExpressions[0]).getBreakPenalty();
49: return 0;
50: }
51:
52: public void dumpExpression(TabbedPrintWriter writer)
53: throws java.io.IOException {
54: /* Don't give a priority; we can't allow parens around
55: * a statement.
56: */
57: subExpressions[0].dumpExpression(writer);
58: }
59: }
|