Source:
private void collectContextualVariableDefinitions(Map<String, VariableType> vars, EObject top, EObject bottom) { Map<String, Collection<VariableType>> definitions = Maps.newHashMap(); EObject context = bottom; while (context != null && context != top.eContainer()) { appendAllLocalVariableDefinitions(definitions, context); if (context != bottom) { if (context instanceof ChangeContext) { ChangeContext f = (ChangeContext) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getBrowseExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); } if (context instanceof For) { For f = (For) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); addDefinition(definitions, f.getIteratorName(), returnTypes); } } if (context instanceof CreateInstance) { CreateInstance f = (CreateInstance) context; changeSelfType(definitions, VariableType.fromString(f.getTypeName())); } if (context != top) { EObject sibling = precedingSibling(context); while (sibling != null) { appendAllLocalVariableDefinitions(definitions, sibling); sibling = precedingSibling(sibling); } } context = context.eContainer(); } for (String var : definitions.keySet()) { vars.put(var, ((List<VariableType>) definitions.get(var)).get(0)); } }

Target:
private void collectContextualVariableDefinitions(Map<String, VariableType> vars, EObject top, EObject bottom) { Map<String, Collection<VariableType>> definitions = Maps.newHashMap(); EObject context = bottom; while (context != null && context != top.eContainer()) { appendAllLocalVariableDefinitions(definitions, context); if (context != bottom) { if (context instanceof ChangeContext) { ChangeContext f = (ChangeContext) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.CHANGE_CONTEXT__BROWSE_EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getBrowseExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); } if (context instanceof For) { For f = (For) context; IInterpreterContext iContext = SiriusInterpreterContextFactory.createInterpreterContext(f, ToolPackage.Literals.FOR__EXPRESSION); ValidationResult res = MultiLanguagesValidator.getInstance().validateExpression(iContext, f.getExpression()); VariableType returnTypes = res.getReturnTypes(); changeSelfType(definitions, returnTypes); addDefinition(definitions, f.getIteratorName(), returnTypes); } } if (context instanceof CreateInstance) { CreateInstance f = (CreateInstance) context; changeSelfType(definitions, VariableType.fromString(f.getTypeName())); } if (context != top) { EObject sibling = precedingSibling(context); while (sibling != null) { appendAllLocalVariableDefinitions(definitions, sibling); sibling = precedingSibling(sibling); } } context = context.eContainer(); } for (String var : definitions.keySet()) { vars.put(var, ((List<VariableType>) definitions.get(var)).get(0)); } }