From 8f13e965b1de20160175b180a794a0d88beb668d Mon Sep 17 00:00:00 2001 From: Daniil Ovchinnikov Date: Tue, 2 Oct 2018 18:09:08 +0300 Subject: [PATCH] [groovy] fix warnings --- .../jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt index 926e1d09f3a2..8e2e00948e7b 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/lang/psi/impl/psiImplUtil.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2017 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-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. package org.jetbrains.plugins.groovy.lang.psi.impl import com.intellij.openapi.util.Key @@ -18,8 +18,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.toplevel.packaging.GrPackageDef import org.jetbrains.plugins.groovy.lang.psi.api.types.CodeReferenceKind import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement -internal fun GroovyFileImpl.getScriptDeclarations(topLevelOnly: Boolean): Array { - val tree = stubTree ?: return collectScriptDeclarations(topLevelOnly) +internal fun getScriptDeclarations(fileImpl: GroovyFileImpl, topLevelOnly: Boolean): Array { + val tree = fileImpl.stubTree ?: return fileImpl.collectScriptDeclarations(topLevelOnly) return if (topLevelOnly) { val root: StubElement<*> = tree.root root.getChildrenByType(GroovyElementTypes.VARIABLE_DEFINITION, GrVariableDeclaration.EMPTY_ARRAY) @@ -76,7 +76,7 @@ fun getQualifiedReferenceName(reference: GrReferenceElement<*>): String? { val name = current.referenceName ?: return null parts.add(name) val qualifier = current.qualifier ?: break - qualifier as? GrReferenceElement<*> ?: return null + if (qualifier !is GrReferenceElement<*>) return null current = qualifier } return parts.reversed().joinToString(separator = ".")