ReturnValue (LighterASTNode statement, LighterASTNode target) { if (statement == null) return null; IElementType tokenType = statement.getTokenType(); if (tokenType == EXPRESSION_STATEMENT) { LighterASTNode expression = findExpressionChild(tree, statement); return findValueInExpression(expression, target); } if (tokenType == DECLARATION_STATEMENT) { List<LighterASTNode> declaredElements = tree.getChildren(statement); for (int i = declaredElements.size() - 1; i >= 0; i--) { LighterASTNode declared = declaredElements.get(i); if (declared.getTokenType() != LOCAL_VARIABLE) continue; LighterASTNode initializer = findExpressionChild(tree, declared); if (declared.equals(target)) { return getExpressionValue(initializer); } ReturnValue value = findValueInExpression(initializer, target); if (value != null) { return value; } } } if (tokenType == BLOCK_STATEMENT) { LighterASTNode block = firstChildOfType(tree, statement, CODE_BLOCK); if (block != null) { List<LighterASTNode> children = getChildrenOfType(tree, block, ElementType.JAVA_STATEMENT_BIT_SET); for (int i = children.size() - 1; i >= 0; i--) { ReturnValue value = findValueInStatement(children.get(i), target); if (value != null) { return value; } } } return null; } if (tokenType == IF_STATEMENT) { ReturnValue value = findValueInIfStatement(statement, target); if (value != null) { return value; } } if (isAssignedInside(statement, target)) return ReturnValue.UNKNOWN; return null; }