[uast] Fix simple style warnings

GitOrigin-RevId: 40093e44584def10c83dc3e8f88e79d102b30f23
This commit is contained in:
Bart van Helvert
2025-03-03 15:09:58 +01:00
committed by intellij-monorepo-bot
parent 2160951ed8
commit 9ae603bafc
4 changed files with 7 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2018 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.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmName("UAnnotationUtils")
package org.jetbrains.uast
@@ -106,4 +106,4 @@ fun getContainingAnnotationEntry(uElement: UElement?): Pair<PsiAnnotation, Strin
private fun isResolvedToAnnotation(reference: UReferenceExpression?) = (reference?.resolve() as? PsiClass)?.isAnnotationType == true
private val UElement.parentAnyway
get() = uastParent ?: generateSequence(sourcePsi?.parent, { it.parent }).mapNotNull { it.toUElement() }.firstOrNull()
get() = uastParent ?: generateSequence(sourcePsi?.parent) { it.parent }.mapNotNull { it.toUElement() }.firstOrNull()

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.uast
import com.intellij.lang.Language
@@ -14,8 +14,6 @@ import org.jetbrains.uast.util.classSetOf
* Extension to provide UAST (Unified Abstract Syntax Tree) language support. UAST is an abstraction layer on PSI of different JVM
* languages. It provides a unified API for working with common language elements like classes and method declarations, literal values and
* control flow operators.
*
* @see org.jetbrains.uast.generate.UastCodeGenerationPlugin for UAST code generation.
*/
@JvmDefaultWithCompatibility
interface UastLanguagePlugin {

View File

@@ -1,10 +1,10 @@
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package org.jetbrains.uast
import org.jetbrains.annotations.ApiStatus
@ApiStatus.Internal
val UNINITIALIZED_UAST_PART = object : Any() {
val UNINITIALIZED_UAST_PART: Any = object : Any() {
override fun toString(): String {
return "UNINITIALIZED_UAST_PART"
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
@file:JvmMultifileClass
@file:JvmName("UastUtils")
@@ -133,7 +119,7 @@ fun UExpression.getOutermostQualified(): UQualifiedReferenceExpression? {
tailrec fun getOutermostQualified(current: UElement?, previous: UExpression): UQualifiedReferenceExpression? = when (current) {
is UQualifiedReferenceExpression -> getOutermostQualified(current.uastParent, current)
is UParenthesizedExpression -> getOutermostQualified(current.uastParent, previous)
else -> if (previous is UQualifiedReferenceExpression) previous else null
else -> previous as? UQualifiedReferenceExpression
}
return getOutermostQualified(this.uastParent, this)