01: /* LocalVarOperator 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: LocalVarOperator.java.in,v 4.1.2.1 2002/05/28 17:34:06 hoenicke Exp $
18: */
19:
20: package jode.expr;
21:
22: import jode.GlobalOptions;
23: import jode.type.Type;
24: import jode.decompiler.LocalInfo;
25: import jode.decompiler.TabbedPrintWriter;
26:
27: import java.util.Collection;
28:
29: public abstract class LocalVarOperator extends Operator {
30: LocalInfo local;
31:
32: public LocalVarOperator(Type lvalueType, LocalInfo local) {
33: super (lvalueType);
34: this .local = local;
35: local.setOperator(this );
36: initOperands(0);
37: }
38:
39: public abstract boolean isRead();
40:
41: public abstract boolean isWrite();
42:
43: public void updateSubTypes() {
44: if (parent != null
45: && (GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
46: GlobalOptions.err.println("local type changed in: "
47: + parent);
48: local.setType(type);
49: }
50:
51: public void updateType() {
52: updateParentType(local.getType());
53: }
54:
55: public void fillDeclarables(Collection used) {
56: used.add(local);
57: super .fillDeclarables(used);
58: }
59:
60: public LocalInfo getLocalInfo() {
61: return local.getLocalInfo();
62: }
63:
64: public void setLocalInfo(LocalInfo newLocal) {
65: local = newLocal;
66: updateType();
67: }
68:
69: public int getPriority() {
70: return 1000;
71: }
72:
73: public void dumpExpression(TabbedPrintWriter writer) {
74: writer.print(local.getName());
75: }
76: }
|