compiler.compileMember(call.getArg(0));
final Type type1 = call.getArg(1).getType();
if (type1 instanceof LevelType) {
final LevelCalc levelCalc =
compiler.compileLevel(call.getArg(1));
return new AbstractListCalc(
call, new Calc[] {memberCalc, levelCalc})
{
public TupleList evaluateList(Evaluator evaluator) {
Level level = levelCalc.evaluateLevel(evaluator);
Member member = memberCalc.evaluateMember(evaluator);
int distance =
member.getDepth() - level.getDepth();
List<Member> ancestors = new ArrayList<Member>();
for (int curDist = 1; curDist <= distance; curDist++) {
ancestors.add(
ancestor(evaluator, member, curDist, null));
}
return TupleCollections.asTupleList(ancestors);
}
};
} else {
final IntegerCalc distanceCalc =
compiler.compileInteger(call.getArg(1));
return new AbstractListCalc(
call, new Calc[] {memberCalc, distanceCalc})
{
public TupleList evaluateList(Evaluator evaluator) {
Member member = memberCalc.evaluateMember(evaluator);
int distance = distanceCalc.evaluateInteger(evaluator);