Pulled up functions for working with stack on top level
This commit is contained in:
-6
@@ -24,12 +24,6 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
|
||||
private fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
private fun <E> MutableList<E>.pop() = this.removeAt(size - 1)
|
||||
|
||||
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||
|
||||
internal class ScopeWithIr(val scope: Scope, val irElement: IrElement)
|
||||
|
||||
abstract internal class IrElementTransformerVoidWithContext : IrElementTransformerVoid() {
|
||||
|
||||
+8
-1
@@ -40,4 +40,11 @@ val BackendContext.messageCollector: MessageCollector
|
||||
fun BackendContext.reportWarning(message: String, irFile: IrFile, irElement: IrElement) {
|
||||
val location = irElement.getCompilerMessageLocation(irFile)
|
||||
this.messageCollector.report(CompilerMessageSeverity.WARNING, message, location)
|
||||
}
|
||||
}
|
||||
|
||||
fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
fun <E> MutableList<E>.pop() = this.removeAt(size - 1)
|
||||
|
||||
fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||
|
||||
|
||||
+1
-6
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.lower
|
||||
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.ir.IrElement
|
||||
import org.jetbrains.kotlin.ir.declarations.*
|
||||
@@ -31,12 +32,6 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils
|
||||
// TODO: rename the file.
|
||||
class Closure(val capturedValues: List<ValueDescriptor> = emptyList())
|
||||
|
||||
private fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
private fun <E> MutableList<E>.pop() = this.removeAt(size - 1)
|
||||
|
||||
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||
|
||||
class ClosureAnnotator {
|
||||
private val closureBuilders = mutableMapOf<DeclarationDescriptor, ClosureBuilder>()
|
||||
|
||||
|
||||
+1
-6
@@ -3,6 +3,7 @@ package org.jetbrains.kotlin.backend.konan.lower
|
||||
import org.jetbrains.kotlin.backend.common.DeepCopyIrTreeWithDeclarations
|
||||
import org.jetbrains.kotlin.backend.common.FunctionLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.synthesizedName
|
||||
import org.jetbrains.kotlin.backend.konan.ir.IrReturnableBlockImpl
|
||||
@@ -26,12 +27,6 @@ import org.jetbrains.kotlin.types.typeUtil.isUnit
|
||||
|
||||
internal class FinallyBlocksLowering(val context: Context): FunctionLoweringPass {
|
||||
|
||||
private fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
private fun <E> MutableList<E>.pop() = this.removeAt(size - 1)
|
||||
|
||||
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||
|
||||
private interface HighLevelJump {
|
||||
fun toIr(context: Context, startOffset: Int, endOffset: Int, value: IrExpression): IrExpression
|
||||
}
|
||||
|
||||
+1
-6
@@ -20,6 +20,7 @@ import org.jetbrains.kotlin.backend.common.DeclarationContainerLoweringPass
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.explicitParameters
|
||||
import org.jetbrains.kotlin.backend.common.descriptors.isSuspend
|
||||
import org.jetbrains.kotlin.backend.common.lower.*
|
||||
import org.jetbrains.kotlin.backend.common.*
|
||||
import org.jetbrains.kotlin.backend.konan.Context
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalClass
|
||||
import org.jetbrains.kotlin.backend.konan.descriptors.getKonanInternalFunctions
|
||||
@@ -1288,12 +1289,6 @@ internal class SuspendFunctionsLowering(val context: Context): DeclarationContai
|
||||
|
||||
private open class VariablesScopeTracker: IrElementVisitorVoid {
|
||||
|
||||
private fun <E> MutableList<E>.push(element: E) = this.add(element)
|
||||
|
||||
private fun <E> MutableList<E>.pop() = this.removeAt(size - 1)
|
||||
|
||||
private fun <E> MutableList<E>.peek(): E? = if (size == 0) null else this[size - 1]
|
||||
|
||||
protected val scopeStack = mutableListOf<MutableSet<VariableDescriptor>>(mutableSetOf())
|
||||
|
||||
override fun visitElement(element: IrElement) {
|
||||
|
||||
Reference in New Issue
Block a user