01: package gnu.kawa.reflect;
02:
03: import gnu.bytecode.ClassType;
04: import gnu.mapping.*;
05: import gnu.expr.*;
06:
07: public class StaticFieldLocation extends FieldLocation {
08: public StaticFieldLocation(String cname, String fname) {
09: super (null, ClassType.make(cname), fname);
10: }
11:
12: public StaticFieldLocation(ClassType type, String mname) {
13: super (null, type, mname);
14: }
15:
16: public Object get(Object defaultValue) {
17: Object val = super .get(defaultValue);
18: if (val instanceof kawa.lang.Macro)
19: getDeclaration();
20: return val;
21: }
22:
23: public static StaticFieldLocation define(Environment environ,
24: Symbol sym, Object property, String cname, String fname) {
25: StaticFieldLocation loc = new StaticFieldLocation(cname, fname);
26: environ.addLocation(sym, property, loc);
27: return loc;
28: }
29:
30: public static StaticFieldLocation make(Declaration decl) {
31: gnu.bytecode.Field fld = decl.field;
32: ClassType ctype = fld.getDeclaringClass();
33: StaticFieldLocation loc = new StaticFieldLocation(ctype, fld
34: .getName());
35: loc.setDeclaration(decl);
36: //maybe setKindFlags();
37: return loc;
38: }
39:
40: public static StaticFieldLocation make(
41: /*Object name,*/String cname, String fldName) {
42: return new StaticFieldLocation(cname, fldName);
43: }
44: }
|