Added function declarations stack for debugging
This commit is contained in:
+4
@@ -31,11 +31,14 @@ abstract class IrElementTransformerVoidWithContext(): IrElementTransformerVoid()
|
|||||||
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||||
|
|
||||||
private val functionsStack = mutableListOf<FunctionDescriptor>()
|
private val functionsStack = mutableListOf<FunctionDescriptor>()
|
||||||
|
private val functionDeclarationsStack = mutableListOf<IrFunction>()
|
||||||
private val classesStack = mutableListOf<ClassDescriptor>()
|
private val classesStack = mutableListOf<ClassDescriptor>()
|
||||||
|
|
||||||
override final fun visitFunction(declaration: IrFunction): IrStatement {
|
override final fun visitFunction(declaration: IrFunction): IrStatement {
|
||||||
functionsStack.push(declaration.descriptor)
|
functionsStack.push(declaration.descriptor)
|
||||||
|
functionDeclarationsStack.push(declaration)
|
||||||
val result = visitFunctionNew(declaration)
|
val result = visitFunctionNew(declaration)
|
||||||
|
functionDeclarationsStack.pop()
|
||||||
functionsStack.pop()
|
functionsStack.pop()
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
@@ -48,6 +51,7 @@ abstract class IrElementTransformerVoidWithContext(): IrElementTransformerVoid()
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected val currentFunction get() = functionsStack.peek()
|
protected val currentFunction get() = functionsStack.peek()
|
||||||
|
protected val currentFunctionDeclaration get() = functionDeclarationsStack.peek()
|
||||||
protected val currentClass get() = classesStack.peek()
|
protected val currentClass get() = classesStack.peek()
|
||||||
|
|
||||||
open fun visitFunctionNew(declaration: IrFunction) : IrStatement {
|
open fun visitFunctionNew(declaration: IrFunction) : IrStatement {
|
||||||
|
|||||||
Reference in New Issue
Block a user