FIR/UAST: commonize loop/break/continue expressions
This commit is contained in:
committed by
Ilya Kirillov
parent
1146f60db3
commit
50f750187b
+29
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtDoWhileExpression
|
||||
import org.jetbrains.uast.UDoWhileExpression
|
||||
import org.jetbrains.uast.UElement
|
||||
import org.jetbrains.uast.UIdentifier
|
||||
|
||||
class KotlinUDoWhileExpression(
|
||||
override val sourcePsi: KtDoWhileExpression,
|
||||
givenParent: UElement?
|
||||
) : KotlinAbstractUExpression(givenParent), UDoWhileExpression {
|
||||
override val condition by lz {
|
||||
baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.condition, this)
|
||||
}
|
||||
override val body by lz {
|
||||
baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.body, this)
|
||||
}
|
||||
|
||||
override val doIdentifier: UIdentifier
|
||||
get() = KotlinUIdentifier(null, this)
|
||||
|
||||
override val whileIdentifier: UIdentifier
|
||||
get() = KotlinUIdentifier(null, this)
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtWhileExpression
|
||||
import org.jetbrains.uast.UElement
|
||||
import org.jetbrains.uast.UIdentifier
|
||||
import org.jetbrains.uast.UWhileExpression
|
||||
|
||||
class KotlinUWhileExpression(
|
||||
override val sourcePsi: KtWhileExpression,
|
||||
givenParent: UElement?
|
||||
) : KotlinAbstractUExpression(givenParent), UWhileExpression {
|
||||
override val condition by lz {
|
||||
baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.condition, this)
|
||||
}
|
||||
override val body by lz {
|
||||
baseResolveProviderService.baseKotlinConverter.convertOrEmpty(sourcePsi.body, this)
|
||||
}
|
||||
|
||||
override val whileIdentifier: UIdentifier
|
||||
get() = KotlinUIdentifier(null, this)
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtBreakExpression
|
||||
import org.jetbrains.uast.UBreakExpression
|
||||
import org.jetbrains.uast.UElement
|
||||
import org.jetbrains.uast.kotlin.KotlinAbstractUExpression
|
||||
|
||||
class KotlinUBreakExpression(
|
||||
override val sourcePsi: KtBreakExpression,
|
||||
givenParent: UElement?
|
||||
) : KotlinAbstractUExpression(givenParent), UBreakExpression {
|
||||
override val label: String?
|
||||
get() = sourcePsi.getLabelName()
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.uast.kotlin
|
||||
|
||||
import org.jetbrains.kotlin.psi.KtContinueExpression
|
||||
import org.jetbrains.uast.UContinueExpression
|
||||
import org.jetbrains.uast.UElement
|
||||
import org.jetbrains.uast.kotlin.KotlinAbstractUExpression
|
||||
|
||||
class KotlinUContinueExpression(
|
||||
override val sourcePsi: KtContinueExpression,
|
||||
givenParent: UElement?
|
||||
) : KotlinAbstractUExpression(givenParent), UContinueExpression {
|
||||
override val label: String?
|
||||
get() = sourcePsi.getLabelName()
|
||||
}
|
||||
Reference in New Issue
Block a user