mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] pull up #buildCastFix implementation from ConstructorCallHighlighter to CallReferenceHighlighter
GitOrigin-RevId: 0d717dea6eddd26ee370697109550a32dafa69cc
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7abb25cd4e
commit
92224ebfba
+8
-1
@@ -138,5 +138,12 @@ abstract class CallReferenceHighlighter(protected val reference: GroovyCallRefer
|
||||
}
|
||||
}
|
||||
|
||||
protected open fun buildCastFix(argument: ExpressionArgument, expectedType: PsiType): LocalQuickFix? = null
|
||||
protected open fun buildCastFix(argument: ExpressionArgument, expectedType: PsiType): LocalQuickFix? {
|
||||
val arguments = reference.arguments ?: return null
|
||||
val position = arguments.indexOf(argument)
|
||||
if (position < 0) {
|
||||
return null
|
||||
}
|
||||
return ParameterCastFix(argument.expression, position, expectedType)
|
||||
}
|
||||
}
|
||||
|
||||
-11
@@ -1,14 +1,12 @@
|
||||
// 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.codeInspection.type.highlighting
|
||||
|
||||
import com.intellij.codeInspection.LocalQuickFix
|
||||
import com.intellij.psi.PsiType
|
||||
import org.jetbrains.plugins.groovy.GroovyBundle
|
||||
import org.jetbrains.plugins.groovy.highlighting.HighlightSink
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.GroovyMethodResult
|
||||
import org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.DefaultConstructor
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.api.Arguments
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.api.ExpressionArgument
|
||||
import org.jetbrains.plugins.groovy.lang.resolve.api.GroovyCallReference
|
||||
|
||||
abstract class ConstructorCallHighlighter(reference: GroovyCallReference, sink: HighlightSink) : CallReferenceHighlighter(reference, sink) {
|
||||
@@ -25,14 +23,5 @@ abstract class ConstructorCallHighlighter(reference: GroovyCallReference, sink:
|
||||
}
|
||||
}
|
||||
|
||||
override fun buildCastFix(argument: ExpressionArgument, expectedType: PsiType): LocalQuickFix? {
|
||||
val arguments = reference.arguments ?: return null
|
||||
val position = arguments.indexOf(argument)
|
||||
if (position < 0) {
|
||||
return null
|
||||
}
|
||||
return ParameterCastFix(argument.expression, position, expectedType)
|
||||
}
|
||||
|
||||
fun highlight(): Boolean = highlightMethodApplicability()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user