[FIR] Add synthetic else branch to when if it's missing to LightTreeFirBuilder
This commit is contained in:
+5
@@ -497,6 +497,7 @@ class ExpressionsConverter(
|
|||||||
if (hasSubject) {
|
if (hasSubject) {
|
||||||
subject.bind(this)
|
subject.bind(this)
|
||||||
}
|
}
|
||||||
|
var thereIsElse = false
|
||||||
for (entry in whenEntries) {
|
for (entry in whenEntries) {
|
||||||
val branch = entry.firBlock
|
val branch = entry.firBlock
|
||||||
branches += if (!entry.isElse) {
|
branches += if (!entry.isElse) {
|
||||||
@@ -508,11 +509,15 @@ class ExpressionsConverter(
|
|||||||
FirWhenBranchImpl(null, firCondition, branch)
|
FirWhenBranchImpl(null, firCondition, branch)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
thereIsElse = true
|
||||||
FirWhenBranchImpl(
|
FirWhenBranchImpl(
|
||||||
null, FirElseIfTrueCondition(null), branch
|
null, FirElseIfTrueCondition(null), branch
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!thereIsElse) {
|
||||||
|
branches += FirWhenBranchImpl(null, FirElseIfTrueCondition(null), FirEmptyExpressionBlock())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user