Don't look twice for the same variables
- This reduces calls to all scope resolution methods
This commit is contained in:

committed by
Andreas Dangel

parent
c88c1a02d4
commit
95101fddaf
@ -47,13 +47,14 @@ public class Search {
|
||||
if (TRACE) {
|
||||
System.out.println(" checking scope " + scope + " for name occurrence " + nameOccurrence);
|
||||
}
|
||||
if (!scope.contains(nameOccurrence) && scope.getParent() != null) {
|
||||
final boolean isInScope = scope.contains(nameOccurrence);
|
||||
if (!isInScope && scope.getParent() != null) {
|
||||
if (TRACE) {
|
||||
System.out.println(" moving up from " + scope + " to " + scope.getParent());
|
||||
}
|
||||
return searchUpward(nameOccurrence, scope.getParent());
|
||||
}
|
||||
if (scope.contains(nameOccurrence)) {
|
||||
if (isInScope) {
|
||||
if (TRACE) {
|
||||
System.out.println(" found it!");
|
||||
}
|
||||
|
Reference in New Issue
Block a user