KtLightAnnotationForSourceEntry: varargs handling improved (KT-21335, EA-107118)
This commit is contained in:
committed by
xiexed
parent
23344783a5
commit
07601b2ec4
@@ -139,8 +139,14 @@ class KtLightAnnotationForSourceEntry(
|
||||
|
||||
is VarargValueArgument ->
|
||||
memberValue.unwrapArray(resolvedArgument.arguments)
|
||||
?: resolvedArgument.arguments.first().asElement().parent.parent.let {
|
||||
it.asKtCall() ?: it
|
||||
?: resolvedArgument.arguments.first().asElement().let {
|
||||
(it as? KtValueArgument)
|
||||
?.takeIf {
|
||||
it.getSpreadElement() != null ||
|
||||
it.getArgumentName() != null ||
|
||||
it.getArgumentExpression() is KtCollectionLiteralExpression
|
||||
}
|
||||
?.getArgumentExpression() ?: it.parent
|
||||
}
|
||||
|
||||
else -> error("resolvedArgument: ${resolvedArgument.javaClass} cant be processed")
|
||||
@@ -189,6 +195,7 @@ class KtLightAnnotationForSourceEntry(
|
||||
wrapAnnotationValue(memberValue, this, {
|
||||
originalExpression.let { ktOrigin ->
|
||||
when (ktOrigin) {
|
||||
is KtValueArgumentList -> ktOrigin.arguments.getOrNull(i)?.getArgumentExpression()
|
||||
is KtCallElement -> ktOrigin.valueArguments.getOrNull(i)?.getArgumentExpression()
|
||||
is KtCollectionLiteralExpression -> ktOrigin.getInnerExpressions().getOrNull(i)
|
||||
else -> null
|
||||
|
||||
Reference in New Issue
Block a user