Simplify logic now that null is always returned.
This commit is contained in:
@@ -136,20 +136,14 @@ public class Template
|
|||||||
return checkForMissing(name, line, missingIsNull, getValueIn(ctx.data, name, line));
|
return checkForMissing(name, line, missingIsNull, getValueIn(ctx.data, name, line));
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean variableMissing = true;
|
|
||||||
while (ctx != null) {
|
while (ctx != null) {
|
||||||
Object value = getValueIn(ctx.data, name, line);
|
Object value = getValueIn(ctx.data, name, line);
|
||||||
if (value == NO_FETCHER_FOUND) {
|
if (value != NO_FETCHER_FOUND) return value;
|
||||||
// preserve variableMissing
|
|
||||||
} else {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
ctx = ctx.parent;
|
ctx = ctx.parent;
|
||||||
}
|
}
|
||||||
// we've popped off the top of our stack of contexts, if we never actually found a fetcher
|
// we've popped off the top of our stack of contexts; we never found a fetcher for our
|
||||||
// for our variable, we need to let checkForMissing() know
|
// variable, so let checkForMissing() decide what to do
|
||||||
return checkForMissing(name, line, missingIsNull,
|
return checkForMissing(name, line, missingIsNull, NO_FETCHER_FOUND);
|
||||||
variableMissing ? NO_FETCHER_FOUND : null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user