[FE 1.0] Remove usages of safeAs and cast from most of FE 1.0 modules:
- :core:descriptors - :core:descriptors.jvm - :core:deserialization - :compiler:cli - :compiler:frontend - :compiler:frontend:cfg - :compiler:frontend.java - :compiler:frontend.common.jvm - :compiler:psi - :compiler:resolution - :compiler:resolution.common - :compiler:resolution.common.jvm - :kotlin-reflect-api
This commit is contained in:
committed by
Space Team
parent
6afceb1e84
commit
d423782fac
+2
-3
@@ -22,7 +22,6 @@ import org.jetbrains.kotlin.psi.*
|
||||
import org.jetbrains.kotlin.resolve.BindingContext
|
||||
import org.jetbrains.kotlin.resolve.BindingContextUtils.variableDescriptorForDeclaration
|
||||
import org.jetbrains.kotlin.util.javaslang.*
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.safeAs
|
||||
|
||||
class PseudocodeVariablesData(val pseudocode: Pseudocode, private val bindingContext: BindingContext) {
|
||||
private val containsDoWhile = pseudocode.rootPseudocode.containsDoWhile
|
||||
@@ -118,12 +117,12 @@ class PseudocodeVariablesData(val pseudocode: Pseudocode, private val bindingCon
|
||||
|
||||
private fun isValWithTrivialInitializer(variableDeclarationElement: KtDeclaration, descriptor: VariableDescriptor) =
|
||||
variableDeclarationElement is KtParameter || variableDeclarationElement is KtObjectDeclaration ||
|
||||
variableDeclarationElement.safeAs<KtVariableDeclaration>()?.isVariableWithTrivialInitializer(descriptor) == true
|
||||
(variableDeclarationElement as? KtVariableDeclaration)?.isVariableWithTrivialInitializer(descriptor) == true
|
||||
|
||||
private fun KtVariableDeclaration.isVariableWithTrivialInitializer(descriptor: VariableDescriptor): Boolean {
|
||||
if (descriptor.isPropertyWithoutBackingField()) return true
|
||||
if (isVar) return false
|
||||
return initializer != null || safeAs<KtProperty>()?.delegate != null || this is KtDestructuringDeclarationEntry
|
||||
return initializer != null || (this as? KtProperty)?.delegate != null || this is KtDestructuringDeclarationEntry
|
||||
}
|
||||
|
||||
private fun VariableDescriptor.isPropertyWithoutBackingField(): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user