public Sequence tryResolveTag(String tag, String nonTerminalName, Element[] els, Object[] labels, boolean[] drops) {
Production p = new Production(tag, nonTerminalName, els, labels, drops);
for(Method m : _cl.getMethods())
- if (new TargetMethod(m).isCompatible(p))
- return new TargetMethod(m).makeSequence(p);
+ if (new Target(m).isCompatible(p))
+ return new Target(m).makeSequence(p);
for(Class c : _inner)
for(Constructor con : c.getConstructors())
- if (new TargetConstructor(con).isCompatible(p))
- return new TargetConstructor(con).makeSequence(p);
+ if (new Target(con).isCompatible(p))
+ return new Target(con).makeSequence(p);
for(Class c : _inner)
- if (new TargetClass(c).isCompatible(p))
- return new TargetClass(c).makeSequence(p);
+ if (new Target(c).isCompatible(p))
+ return new Target(c).makeSequence(p);
return null;
}
public Sequence resolveTag(String tag, String nonTerminalName, Element[] els, Object[] labels, boolean[] drops) {
}
}
- public static abstract class Target {
+ public static class Target {
public int[] buildSequence(Production p) {
Annotation[][] annotations = _bindable.getArgAnnotations();
String[] names = _bindable.getArgNames();
return Target.this.buildSequence(p, names, argtags);
}
private Reflection.Bindable _bindable;
+
+ public Target(Object o) { this(Reflection.Bindable.create(o)); }
public Target(Reflection.Bindable b) { this._bindable = b; }
public String getName() { return _bindable.getSimpleName(); }
}
}
- public static class TargetClass extends Target {
- public final Class _class;
- public TargetClass(Class _class) { super(Reflection.Bindable.create(_class)); this._class = _class; }
- }
-
- public static class TargetConstructor extends Target {
- public final Constructor _ctor;
- public TargetConstructor(Constructor _ctor) { super(Reflection.Bindable.create(_ctor)); this._ctor = _ctor; }
- }
- public static class TargetMethod extends Target {
- public final Method _method;
- public TargetMethod(Method _method) { super(Reflection.Bindable.create(_method)); this._method = _method; }
- }
-
public static Union cached = null;
public static Union make() {
if (cached != null) return cached;