mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Revert "[groovy] add GrMethodCall pattern"
This reverts commit fc5395ce GitOrigin-RevId: 6b52b4a0138250f76b32c76b896d2a89977b8e51
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bcc25d967a
commit
911388590f
@@ -19,7 +19,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrRefere
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals.GrLiteral
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.signatures.GrClosureSignatureUtil.findCall
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.statements.expressions.TypesUtil.createType
|
||||
import org.jetbrains.plugins.groovy.lang.psi.patterns.groovyMethodCall
|
||||
import org.jetbrains.plugins.groovy.lang.psi.patterns.groovyClosure
|
||||
import org.jetbrains.plugins.groovy.lang.psi.patterns.psiMethod
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.ResolveUtil.unwrapClassType
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.delegatesTo.DelegatesToInfo
|
||||
@@ -45,12 +45,12 @@ class GradleTaskDeclarationTypeCalculator : GrTypeCalculator<GrReferenceExpressi
|
||||
class GradleTaskDeclarationClosureDelegateProvider : GrDelegatesToProvider {
|
||||
|
||||
companion object {
|
||||
private val projectTaskMethod = groovyMethodCall.resolvesTo(psiMethod(GRADLE_API_PROJECT, "task"))
|
||||
private val projectTaskMethod = groovyClosure().inMethod(psiMethod(GRADLE_API_PROJECT, "task"))
|
||||
}
|
||||
|
||||
override fun getDelegatesToInfo(expression: GrFunctionalExpression): DelegatesToInfo? {
|
||||
val methodCall = findCall(expression) ?: return null
|
||||
if (isTaskIdCall(methodCall) || projectTaskMethod.accepts(methodCall)) {
|
||||
if (isTaskIdCall(methodCall) || projectTaskMethod.accepts(expression)) {
|
||||
val taskType = getFromNamedArgument(methodCall) ?: createType(GRADLE_API_TASK, expression)
|
||||
return DelegatesToInfo(taskType, Closure.DELEGATE_FIRST)
|
||||
}
|
||||
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.plugins.groovy.lang.psi.patterns
|
||||
|
||||
import com.intellij.patterns.ElementPattern
|
||||
import com.intellij.patterns.PatternCondition
|
||||
import com.intellij.psi.PsiMethod
|
||||
import com.intellij.util.ProcessingContext
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrMethodCall
|
||||
|
||||
class GroovyMethodCallPattern : GroovyExpressionPattern<GrMethodCall, GroovyMethodCallPattern>(GrMethodCall::class.java) {
|
||||
|
||||
fun resolvesTo(methodPattern: ElementPattern<out PsiMethod>): GroovyMethodCallPattern {
|
||||
return with(object : PatternCondition<GrMethodCall>("resolves to method") {
|
||||
override fun accepts(t: GrMethodCall, context: ProcessingContext?): Boolean {
|
||||
val result = t.advancedResolve().element as? PsiMethod ?: return false
|
||||
return methodPattern.accepts(result, context)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -43,7 +43,7 @@ fun PsiMethodPattern.withKind(kind: Any): PsiMethodPattern {
|
||||
}
|
||||
|
||||
fun groovyClosure(): GroovyClosurePattern = GroovyClosurePattern()
|
||||
val groovyMethodCall: GroovyMethodCallPattern = GroovyMethodCallPattern()
|
||||
|
||||
val groovyAnnotationArgumentValue: GroovyElementPattern.Capture<GrAnnotationMemberValue> = groovyElement()
|
||||
val groovyAnnotationArgument: GroovyAnnotationArgumentPattern.Capture = GroovyAnnotationArgumentPattern.Capture()
|
||||
val groovyAnnotationArgumentList: GroovyElementPattern.Capture<GrAnnotationArgumentList> = groovyElement()
|
||||
|
||||
Reference in New Issue
Block a user