mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] add api for determining whether some expression is not really an expression
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
// 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
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression
|
||||
|
||||
@Experimental
|
||||
interface GroovyExpressionFilter {
|
||||
|
||||
/**
|
||||
* @return `true` if [expression] is not really an expression,
|
||||
* meaning it would be transformed into something else
|
||||
*/
|
||||
fun isFake(expression: GrExpression): Boolean
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// 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.
|
||||
@file:JvmName("GroovyExpressionUtil")
|
||||
|
||||
package org.jetbrains.plugins.groovy.lang.psi.util
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName
|
||||
import org.jetbrains.plugins.groovy.lang.GroovyExpressionFilter
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression
|
||||
|
||||
private val EP_NAME = ExtensionPointName.create<GroovyExpressionFilter>("org.intellij.groovy.expressionFilter")
|
||||
|
||||
fun GrExpression.isFake(): Boolean {
|
||||
return EP_NAME.extensions.any {
|
||||
it.isFake(this)
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@
|
||||
<extensionPoint name="gdslScriptProvider" interface="org.jetbrains.plugins.groovy.dsl.GdslScriptProvider"/>
|
||||
<extensionPoint name="expectedPackageNameProvider" interface="org.jetbrains.plugins.groovy.lang.resolve.ExpectedPackageNameProvider"/>
|
||||
<extensionPoint name="delegatesToProvider" interface="org.jetbrains.plugins.groovy.lang.resolve.delegatesTo.GrDelegatesToProvider"/>
|
||||
<extensionPoint name="expressionFilter" interface="org.jetbrains.plugins.groovy.lang.GroovyExpressionFilter"/>
|
||||
</extensionPoints>
|
||||
|
||||
<extensions defaultExtensionNs="org.intellij.groovy">
|
||||
|
||||
Reference in New Issue
Block a user