Introduce UsageCollector
This commit is contained in:
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.container.*
|
||||
import org.jetbrains.kotlin.context.LazyResolveToken
|
||||
import org.jetbrains.kotlin.context.ModuleContext
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.UsageCollector
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.calls.CallResolver
|
||||
import org.jetbrains.kotlin.resolve.lazy.FileScopeProvider
|
||||
@@ -109,6 +110,7 @@ private fun createContainerForLazyResolve(
|
||||
|
||||
useInstance(dynamicTypesSettings)
|
||||
useInstance(declarationProviderFactory)
|
||||
useInstance(UsageCollector.DO_NOTHING)
|
||||
|
||||
useImpl<LazyResolveToken>()
|
||||
useImpl<ResolveSession>()
|
||||
@@ -134,4 +136,4 @@ public class ContainerForMacros(container: StorageComponentContainer) {
|
||||
val typeResolver: TypeResolver by container
|
||||
val expressionTypingComponents: ExpressionTypingComponents by container
|
||||
val expressionTypingServices: ExpressionTypingServices by container
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.incremental.components
|
||||
|
||||
public interface UsageCollector {
|
||||
companion object {
|
||||
val DO_NOTHING = object : UsageCollector {}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.resolve.lazy
|
||||
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.incremental.components.UsageCollector
|
||||
import org.jetbrains.kotlin.resolve.*
|
||||
import org.jetbrains.kotlin.resolve.lazy.declarations.DeclarationProviderFactory
|
||||
import org.jetbrains.kotlin.storage.StorageManager
|
||||
@@ -32,4 +33,5 @@ public interface LazyClassContext {
|
||||
val typeResolver: TypeResolver
|
||||
val declarationProviderFactory: DeclarationProviderFactory
|
||||
val annotationResolver: AnnotationResolver
|
||||
}
|
||||
val usageCollector: UsageCollector
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.jetbrains.annotations.ReadOnly;
|
||||
import org.jetbrains.kotlin.context.GlobalContext;
|
||||
import org.jetbrains.kotlin.descriptors.*;
|
||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
|
||||
import org.jetbrains.kotlin.incremental.components.UsageCollector;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.psi.*;
|
||||
@@ -75,6 +76,7 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
private LazyDeclarationResolver lazyDeclarationResolver;
|
||||
private FileScopeProvider fileScopeProvider;
|
||||
private DeclarationScopeProvider declarationScopeProvider;
|
||||
private UsageCollector usageCollector;
|
||||
|
||||
@Inject
|
||||
public void setJetImportFactory(JetImportsFactory jetImportFactory) {
|
||||
@@ -126,6 +128,11 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
this.declarationScopeProvider = declarationScopeProvider;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setUsageCollector(@NotNull UsageCollector usageCollector) {
|
||||
this.usageCollector = usageCollector;
|
||||
}
|
||||
|
||||
// Only calls from injectors expected
|
||||
@Deprecated
|
||||
public ResolveSession(
|
||||
@@ -401,4 +408,10 @@ public class ResolveSession implements KotlinCodeAnalyzer, LazyClassContext {
|
||||
public FileScopeProvider getFileScopeProvider() {
|
||||
return fileScopeProvider;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public UsageCollector getUsageCollector() {
|
||||
return usageCollector;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
|
||||
import org.jetbrains.kotlin.descriptors.ModuleDescriptor
|
||||
import org.jetbrains.kotlin.frontend.di.createContainerForLazyLocalClassifierAnalyzer
|
||||
import org.jetbrains.kotlin.incremental.components.UsageCollector
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.psi.JetClassOrObject
|
||||
import org.jetbrains.kotlin.psi.debugText.getDebugText
|
||||
@@ -131,6 +132,7 @@ class LocalClassDescriptorHolder(
|
||||
|
||||
}
|
||||
override val annotationResolver = this@LocalClassDescriptorHolder.annotationResolver
|
||||
override val usageCollector: UsageCollector = UsageCollector.DO_NOTHING
|
||||
}
|
||||
,
|
||||
containingDeclaration,
|
||||
@@ -184,4 +186,4 @@ class DeclarationScopeProviderForLocalClassifierAnalyzer(
|
||||
}
|
||||
return super.getOuterDataFlowInfoForDeclaration(elementOfDeclaration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user