01: /*
02: * xtc - The eXTensible Compiler
03: * Copyright (C) 2006 Robert Grimm
04: *
05: * This program is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU General Public License
07: * version 2 as published by the Free Software Foundation.
08: *
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
17: * USA.
18: */
19: package xtc.type;
20:
21: /**
22: * Representation of a reference value. A reference has a base, type,
23: * and an optional offset. The offset, in turn, either is an index or
24: * a field.
25: *
26: * @author Robert Grimm
27: * @version $Revision: 1.2 $
28: */
29: public abstract class RelativeReference extends Reference {
30:
31: /** The base. */
32: protected Reference base;
33:
34: /**
35: * Create a new relative reference.
36: *
37: * @param type The type.
38: * @param base The base.
39: */
40: public RelativeReference(Type type, Reference base) {
41: super (type);
42: this .base = base;
43: }
44:
45: public boolean isConstant() {
46: return base.isConstant();
47: }
48:
49: public boolean hasBase() {
50: return true;
51: }
52:
53: public Reference getBase() {
54: return base;
55: }
56:
57: }
|