Bug571271 : Fix lambda evaluation with outer variables

This issue was introduced by Bug567801 and the fix is corrected to support both type of variable evaluations.

Change-Id: Iaf3b02286809d295d4299e4cd120c94bd91288b5
Signed-off-by: Gayan Perera <gayanper@gmail.com>
diff --git a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/RemoteEvaluatorBuilder.java b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/RemoteEvaluatorBuilder.java
index 149ff12..1701071 100644
--- a/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/RemoteEvaluatorBuilder.java
+++ b/org.eclipse.jdt.debug/eval/org/eclipse/jdt/internal/debug/eval/RemoteEvaluatorBuilder.java
@@ -250,9 +250,9 @@
 		private boolean isParentInLocalBinding(ASTNode parent) {
-			if (parent instanceof Name) {
+			if (parent instanceof QualifiedName) {
 				// this will avoid unwanted upward traversals
-				if (isLocalBinding(((Name) parent).resolveBinding())) {
+				if (isLocalBinding(((QualifiedName) parent).getQualifier().resolveBinding())) {
 					return true;
 				// traverse upstream to see if a parent is already handled
@@ -1509,7 +1509,7 @@
 			// when having code like arr.length the length is identified as a field variable. But since the arr is
 			// already pushed as a variable we don't need to handle length here. So if we have chained field access like
 			// obj.f1.f2 we will only push the obj as a variable.
-			if (!isLocalBinding(binding) && isParentInLocalBinding(node.getParent())) {
+			if (!isLocalBinding(binding) && !isParentInLocalBinding(node.getParent())) {
 				if (binding instanceof IVariableBinding) {
 					IVariableBinding vb = ((IVariableBinding) binding);
 					// For future optimization: Check for duplicates, so same value is only bound once