[IR] Extract IrDeclaration(Access).psiElement extension
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ abstract class ClassCodegen protected constructor(
|
|||||||
throw IllegalStateException("Generating class with invalid name '${type.className}': ${irClass.dump()}")
|
throw IllegalStateException("Generating class with invalid name '${type.className}': ${irClass.dump()}")
|
||||||
}
|
}
|
||||||
defineClass(
|
defineClass(
|
||||||
irClass.descriptor.psiElement,
|
irClass.psiElement,
|
||||||
state.classFileVersion,
|
state.classFileVersion,
|
||||||
irClass.flags,
|
irClass.flags,
|
||||||
signature.name,
|
signature.name,
|
||||||
|
|||||||
+2
-2
@@ -44,9 +44,9 @@ internal fun MethodNode.acceptWithStateMachine(
|
|||||||
val languageVersionSettings = state.languageVersionSettings
|
val languageVersionSettings = state.languageVersionSettings
|
||||||
assert(languageVersionSettings.isReleaseCoroutines()) { "Experimental coroutines are unsupported in JVM_IR backend" }
|
assert(languageVersionSettings.isReleaseCoroutines()) { "Experimental coroutines are unsupported in JVM_IR backend" }
|
||||||
val element = if (irFunction.isSuspend)
|
val element = if (irFunction.isSuspend)
|
||||||
irFunction.symbol.descriptor.psiElement ?: classCodegen.irClass.descriptor.psiElement
|
irFunction.psiElement ?: classCodegen.irClass.psiElement
|
||||||
else
|
else
|
||||||
classCodegen.context.suspendLambdaToOriginalFunctionMap[classCodegen.irClass.attributeOwnerId]!!.symbol.descriptor.psiElement
|
classCodegen.context.suspendLambdaToOriginalFunctionMap[classCodegen.irClass.attributeOwnerId]!!.psiElement
|
||||||
val visitor = CoroutineTransformerMethodVisitor(
|
val visitor = CoroutineTransformerMethodVisitor(
|
||||||
methodVisitor, access, name, desc, signature, exceptions.toTypedArray(),
|
methodVisitor, access, name, desc, signature, exceptions.toTypedArray(),
|
||||||
obtainClassBuilderForCoroutineState = obtainContinuationClassBuilder,
|
obtainClassBuilderForCoroutineState = obtainContinuationClassBuilder,
|
||||||
|
|||||||
+1
-1
@@ -142,5 +142,5 @@ class IrSourceCompilerForInline(
|
|||||||
.report(SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
|
.report(SUSPENSION_POINT_INSIDE_MONITOR, stackTraceElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun findElement() = (callElement.symbol.descriptor.original as? DeclarationDescriptorWithSource)?.source?.getPsi() as? KtElement
|
private fun findElement() = callElement.psiElement as? KtElement
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.Modality
|
|||||||
import org.jetbrains.kotlin.descriptors.Visibilities
|
import org.jetbrains.kotlin.descriptors.Visibilities
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
||||||
|
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrClassSymbol
|
||||||
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
import org.jetbrains.kotlin.ir.symbols.IrSymbol
|
||||||
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
import org.jetbrains.kotlin.ir.types.IrSimpleType
|
||||||
@@ -425,3 +426,9 @@ val IrFunction.deprecationFlags: Int
|
|||||||
val propertyFlags = (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.deprecationFlags ?: 0
|
val propertyFlags = (this as? IrSimpleFunction)?.correspondingPropertySymbol?.owner?.deprecationFlags ?: 0
|
||||||
return originFlags or propertyFlags or (this as IrAnnotationContainer).deprecationFlags
|
return originFlags or propertyFlags or (this as IrAnnotationContainer).deprecationFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val IrDeclaration.psiElement: PsiElement?
|
||||||
|
get() = (descriptor as? DeclarationDescriptorWithSource)?.psiElement
|
||||||
|
|
||||||
|
val IrMemberAccessExpression.psiElement: PsiElement?
|
||||||
|
get() = (symbol.descriptor.original as? DeclarationDescriptorWithSource)?.psiElement
|
||||||
|
|||||||
Reference in New Issue
Block a user