Skip to content

Commit 986e964

Browse files
committed
refactor: move condition to IfArtifact
1 parent 17696a0 commit 986e964

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

common/src/main/kotlin/spp/jetbrains/artifact/model/ControlStructureArtifact.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@
1616
*/
1717
package spp.jetbrains.artifact.model
1818

19+
/**
20+
* A control structure artifact refers to things that control the flow of a program:
21+
* - conditionals (i.e. if/elif/else)
22+
* - for-loops, while-loops, do-while loops
23+
* - try-catch-finally
24+
* - switch statements
25+
*/
1926
interface ControlStructureArtifact {
20-
val condition: ArtifactElement?
2127
val childArtifacts: List<ArtifactElement>
2228
}

common/src/main/kotlin/spp/jetbrains/artifact/model/IfArtifact.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,12 @@ package spp.jetbrains.artifact.model
1818

1919
import com.intellij.psi.PsiElement
2020

21+
/**
22+
* Represents if/elif/else control structures.
23+
*/
2124
abstract class IfArtifact(psiElement: PsiElement) : ArtifactElement(psiElement), ControlStructureArtifact {
2225

23-
abstract override val condition: ArtifactElement?
26+
abstract val condition: ArtifactElement?
2427
abstract val thenBranch: ArtifactElement?
2528
abstract val elseBranch: ArtifactElement?
2629

0 commit comments

Comments
 (0)