@NotNull private static LookupResult lookupSimpleNameReference( @NotNull JetSimpleNameExpression referenceExpression, @NotNull JetScope outerScope, @NotNull LookupMode lookupMode, boolean packageLevel) { Name referencedName = referenceExpression.getReferencedNameAsName(); Collection<DeclarationDescriptor> descriptors = Sets.newLinkedHashSet(); PackageViewDescriptor packageDescriptor = outerScope.getPackage(referencedName); if (packageDescriptor != null) { descriptors.add(packageDescriptor); } ClassifierDescriptor classifierDescriptor = outerScope.getClassifier(referencedName); if (classifierDescriptor != null) { descriptors.add(classifierDescriptor); } if (lookupMode == LookupMode.EVERYTHING) { descriptors.addAll(outerScope.getFunctions(referencedName)); descriptors.addAll(outerScope.getProperties(referencedName)); VariableDescriptor localVariable = outerScope.getLocalVariable(referencedName); if (localVariable != null) { descriptors.add(localVariable); } } return new LookupResult(descriptors, outerScope, packageLevel); }