[AA FIR] mapAnnotationParameters: improve logging

This commit is contained in:
Dmitrii Gridin
2023-01-03 11:59:33 +01:00
committed by Space Team
parent ae68f08856
commit 7982d33677
@@ -1,15 +1,24 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 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.kotlin.analysis.api.fir.annotations
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry
import org.jetbrains.kotlin.analysis.utils.errors.checkWithAttachmentBuilder
import org.jetbrains.kotlin.analysis.utils.errors.withClassEntry
import org.jetbrains.kotlin.fir.declarations.resolved
import org.jetbrains.kotlin.fir.expressions.*
import org.jetbrains.kotlin.fir.expressions.FirAnnotation
import org.jetbrains.kotlin.fir.expressions.FirExpression
import org.jetbrains.kotlin.name.Name
internal fun mapAnnotationParameters(annotation: FirAnnotation): Map<Name, FirExpression> {
assert(annotation.resolved) { "By now the annotations argument mapping should have been resolved" }
checkWithAttachmentBuilder(annotation.resolved, { "By now the annotations argument mapping should have been resolved" }) {
withFirEntry("annotation", annotation)
withClassEntry("annotationTypeRef", annotation.annotationTypeRef)
withClassEntry("typeRef", annotation.typeRef)
}
return annotation.argumentMapping.mapping.mapKeys { (name, _) -> name }
}