Handle context receiver in KtModifierListOwner.addModifierList()
The existing `KtModifierListOwner.addModifierList(newModifierList)` function adds a visibility keyword (e.g., `private`) in front of the `context(..)` modifier, which generates wrong code. This commit fixes it. ^KTIJ-23728 fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
9856204925
commit
a637626601
@@ -16,7 +16,7 @@ import org.jetbrains.kotlin.psi.psiUtil.siblings
|
|||||||
private fun KtModifierListOwner.addModifierList(newModifierList: KtModifierList): KtModifierList {
|
private fun KtModifierListOwner.addModifierList(newModifierList: KtModifierList): KtModifierList {
|
||||||
val anchor = firstChild!!
|
val anchor = firstChild!!
|
||||||
.siblings(forward = true)
|
.siblings(forward = true)
|
||||||
.dropWhile { it is PsiComment || it is PsiWhiteSpace }
|
.dropWhile { it is PsiComment || it is PsiWhiteSpace || it is KtContextReceiverList }
|
||||||
.first()
|
.first()
|
||||||
return addBefore(newModifierList, anchor) as KtModifierList
|
return addBefore(newModifierList, anchor) as KtModifierList
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user