mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-11 02:50:15 +08:00
Fix IDE resolve on startup
This commit is contained in:
parent
6e16ee3d13
commit
e214a43043
@ -127,8 +127,7 @@ val gitVersion: String by lazy {
|
|||||||
exec.waitFor()
|
exec.waitFor()
|
||||||
exec.inputStream.readBytes().toString(Charsets.UTF_8).trim().also {
|
exec.inputStream.readBytes().toString(Charsets.UTF_8).trim().also {
|
||||||
println("Git commit id: $it")
|
println("Git commit id: $it")
|
||||||
}
|
} }.onFailure {
|
||||||
}.onFailure {
|
|
||||||
it.printStackTrace()
|
it.printStackTrace()
|
||||||
return@lazy "UNKNOWN"
|
return@lazy "UNKNOWN"
|
||||||
}.getOrThrow()
|
}.getOrThrow()
|
||||||
|
@ -22,7 +22,7 @@ dependencies {
|
|||||||
compileOnly(kotlin("stdlib-jdk8"))
|
compileOnly(kotlin("stdlib-jdk8"))
|
||||||
|
|
||||||
val core = "1.3.0"
|
val core = "1.3.0"
|
||||||
val console = "1.0-RC-dev-4"
|
val console = "1.0-RC-dev-28"
|
||||||
|
|
||||||
compileOnly("net.mamoe:mirai-console:$console")
|
compileOnly("net.mamoe:mirai-console:$console")
|
||||||
compileOnly("net.mamoe:mirai-core:$core")
|
compileOnly("net.mamoe:mirai-core:$core")
|
||||||
|
@ -19,7 +19,6 @@ import net.mamoe.mirai.console.compiler.common.resolve.findParent
|
|||||||
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
import org.jetbrains.kotlin.descriptors.CallableDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
import org.jetbrains.kotlin.descriptors.ValueParameterDescriptor
|
||||||
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
import org.jetbrains.kotlin.descriptors.VariableDescriptor
|
||||||
import org.jetbrains.kotlin.idea.caches.resolve.resolveToCall
|
|
||||||
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
|
import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
|
||||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||||
import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor
|
import org.jetbrains.kotlin.idea.search.usagesSearch.descriptor
|
||||||
@ -98,7 +97,7 @@ fun KtDeclaration.resolveAllCallsWithElement(bindingContext: BindingContext): Se
|
|||||||
.filterIsInstance<KtCallExpression>()
|
.filterIsInstance<KtCallExpression>()
|
||||||
.mapNotNull {
|
.mapNotNull {
|
||||||
val callee = it.calleeExpression ?: return@mapNotNull null
|
val callee = it.calleeExpression ?: return@mapNotNull null
|
||||||
val resolved = callee.getResolvedCallOrResolveToCall(bindingContext) ?: return@mapNotNull null
|
val resolved = callee.getResolvedCall(bindingContext) ?: return@mapNotNull null
|
||||||
|
|
||||||
resolved to it
|
resolved to it
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ fun KtElement?.getResolvedCallOrResolveToCall(
|
|||||||
context: BindingContext,
|
context: BindingContext,
|
||||||
bodyResolveMode: BodyResolveMode = BodyResolveMode.PARTIAL,
|
bodyResolveMode: BodyResolveMode = BodyResolveMode.PARTIAL,
|
||||||
): ResolvedCall<out CallableDescriptor>? {
|
): ResolvedCall<out CallableDescriptor>? {
|
||||||
return this?.getCall(context)?.getResolvedCall(context) ?: this?.resolveToCall(bodyResolveMode)
|
return this?.getCall(context)?.getResolvedCall(context)// ?: this?.resolveToCall(bodyResolveMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
val ResolvedCall<out CallableDescriptor>.valueParameters: List<ValueParameterDescriptor> get() = this.resultingDescriptor.valueParameters
|
val ResolvedCall<out CallableDescriptor>.valueParameters: List<ValueParameterDescriptor> get() = this.resultingDescriptor.valueParameters
|
||||||
|
Loading…
Reference in New Issue
Block a user