Fix after review KT-CR-4441 of cc5382b3

Simplify API of InlineConstTracker
In ConstLowering: Move transformer logic to another class to avoid mutable state. Avoid marking all files in module as module. Support of inner classes.

#KT-46506 Fixed
This commit is contained in:
Aleksei.Cherepanov
2021-09-16 00:30:16 +03:00
committed by teamcityserver
parent c2715d26f1
commit 47a1dd27dd
6 changed files with 53 additions and 55 deletions
@@ -19,7 +19,6 @@ package org.jetbrains.kotlin.daemon.client
import org.jetbrains.kotlin.daemon.common.*
import org.jetbrains.kotlin.incremental.components.ExpectActualTracker
import org.jetbrains.kotlin.incremental.components.InlineConstTracker
import org.jetbrains.kotlin.incremental.components.ConstantRef
import org.jetbrains.kotlin.incremental.components.LookupInfo
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.incremental.js.IncrementalDataProvider
@@ -121,8 +120,8 @@ open class CompilerCallbackServicesFacadeServer(
expectActualTracker!!.report(File(expectedFilePath), File(actualFilePath))
}
override fun inlineConstTracker_report(className: String, cRefs: Collection<ConstantRef>) {
inlineConstTracker?.report(className, cRefs) ?: throw NullPointerException("inlineConstTracker was not initialized")
override fun inlineConstTracker_report(filePath: String, owner: String, name: String, constType: String) {
inlineConstTracker?.report(filePath, owner, name, constType) ?: throw NullPointerException("inlineConstTracker was not initialized")
}
override fun incrementalResultsConsumer_processHeader(headerMetadata: ByteArray) {
@@ -17,7 +17,6 @@
package org.jetbrains.kotlin.daemon.common
import org.jetbrains.kotlin.incremental.components.LookupInfo
import org.jetbrains.kotlin.incremental.components.ConstantRef
import org.jetbrains.kotlin.incremental.js.JsInlineFunctionHash
import org.jetbrains.kotlin.load.kotlin.incremental.components.JvmPackagePartProto
import org.jetbrains.kotlin.modules.TargetId
@@ -108,7 +107,7 @@ interface CompilerCallbackServicesFacade : Remote {
// ---------------------------------------------------
// InlineConstTracker
@Throws(RemoteException::class)
fun inlineConstTracker_report(className: String, cRefs: Collection<ConstantRef>)
fun inlineConstTracker_report(filePath: String, owner: String, name: String, constType: String)
// ---------------------------------------------------
// IncrementalResultsConsumer (js)
@@ -9,15 +9,14 @@ import org.jetbrains.kotlin.daemon.common.DummyProfiler
import org.jetbrains.kotlin.daemon.common.Profiler
import org.jetbrains.kotlin.daemon.common.withMeasure
import org.jetbrains.kotlin.incremental.components.InlineConstTracker
import org.jetbrains.kotlin.incremental.components.ConstantRef
class RemoteInlineConstTracker(
@Suppress("DEPRECATION") val facade: org.jetbrains.kotlin.daemon.common.CompilerCallbackServicesFacade,
val profiler: Profiler = DummyProfiler()
): InlineConstTracker {
override fun report(filePath: String, cRefs: Collection<ConstantRef>) {
override fun report(filePath: String, owner: String, name: String, constType: String) {
profiler.withMeasure(this) {
facade.inlineConstTracker_report(filePath, cRefs)
facade.inlineConstTracker_report(filePath, owner, name, constType)
}
}
}