Changes on code review
This commit is contained in:
@@ -62,7 +62,7 @@ public abstract class AbstractJetParsingTest extends ParsingTestCase {
|
||||
if (!methodName.startsWith("get") && !methodName.startsWith("find") ||
|
||||
methodName.equals("getReference") ||
|
||||
methodName.equals("getReferences") ||
|
||||
methodName.startsWith("getUseScope") ||
|
||||
methodName.equals("getUseScope") ||
|
||||
methodName.equals("getPresentation")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+7
-2
@@ -49,10 +49,15 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
|
||||
val effectiveSearchScope = runReadAction { queryParameters.effectiveSearchScope }
|
||||
|
||||
val refFilter: (PsiReference) -> Boolean = if (unwrappedElement is JetParameter)
|
||||
({ ref: PsiReference -> !ref.isNamedArgumentReference()/* they are processed later*/ })
|
||||
else
|
||||
({true})
|
||||
|
||||
words.forEach { word ->
|
||||
queryParameters.optimizer.searchWord(word, effectiveSearchScope,
|
||||
UsagesSearchLocation.EVERYWHERE.searchContext, true, unwrappedElement,
|
||||
MyRequestResultProcessor(unwrappedElement) { !it.isNamedArgumentReference()/* they are processed later*/ })
|
||||
MyRequestResultProcessor(unwrappedElement, refFilter))
|
||||
}
|
||||
|
||||
if (unwrappedElement is JetParameter) {
|
||||
@@ -71,7 +76,7 @@ public class KotlinReferencesSearcher : QueryExecutorBase<PsiReference, Referenc
|
||||
var namedArgsScope = function.useScope.intersectWith(queryParameters.scopeDeterminedByUser)
|
||||
|
||||
if (namedArgsScope is GlobalSearchScope) {
|
||||
namedArgsScope = JetSourceFilterScope.kotlinSources(namedArgsScope, project)
|
||||
namedArgsScope = JetSourceFilterScope.kotlinSourcesAndLibraries(namedArgsScope, project)
|
||||
|
||||
val filesWithFunctionName = CacheManager.SERVICE.getInstance(project).getVirtualFilesWithWord(
|
||||
function.name!!, UsageSearchContext.IN_CODE, namedArgsScope, true)
|
||||
|
||||
+2
-2
@@ -268,14 +268,14 @@ class PropertyUsagesSearchHelper(
|
||||
|
||||
var scope = function.useScope and target.effectiveScope
|
||||
if (scope is GlobalSearchScope) {
|
||||
scope = JetSourceFilterScope.kotlinSources(scope, element.project)
|
||||
scope = JetSourceFilterScope.kotlinSourcesAndLibraries(scope, element.project)
|
||||
}
|
||||
|
||||
val additionalFilter1 = AdditionalFileFilter(element.name!!, KOTLIN_NAMED_ARGUMENT_SEARCH_CONTEXT, true)
|
||||
val additionalFilter2 = AdditionalFileFilter(function.name!!, UsageSearchContext.IN_CODE, true)
|
||||
val namedArgsRequest = UsagesSearchRequestItem(target.withScope(scope),
|
||||
listOf(element.name!!),
|
||||
(PsiReference::isNamedArgumentUsage).searchFilter,
|
||||
(PsiReference::isNamedArgumentUsage).searchFilter and makeFilter(target),
|
||||
additionalFileFilters = listOf(additionalFilter1, additionalFilter2))
|
||||
return listOf(realUsagesRequest, namedArgsRequest)
|
||||
}
|
||||
|
||||
+8
@@ -5,6 +5,14 @@ fun foo<T>(<caret>t: T): T {
|
||||
return t
|
||||
}
|
||||
|
||||
fun bar(t: String) {
|
||||
print(t)
|
||||
}
|
||||
|
||||
fun usage() {
|
||||
foo(t = ":)")
|
||||
}
|
||||
|
||||
fun falseUsage() {
|
||||
bar(t = "")
|
||||
}
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
Named argument (9: 9) foo(t = ":)")
|
||||
Named argument (13: 9) foo(t = ":)")
|
||||
Value read (4: 13) println(t)
|
||||
Value read (5: 12) return t
|
||||
Reference in New Issue
Block a user