Move Variable data class to separate file

This commit is contained in:
Ivan Kylchik
2020-04-07 10:11:53 +03:00
parent ef4e4881b7
commit 30e352ea27
2 changed files with 20 additions and 11 deletions
@@ -8,19 +8,8 @@ package org.jetbrains.kotlin.backend.common.interpreter.stack
import org.jetbrains.kotlin.backend.common.interpreter.equalTo
import org.jetbrains.kotlin.backend.common.interpreter.state.State
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
import kotlin.NoSuchElementException
data class Variable(val descriptor: DeclarationDescriptor, val state: State) {
override fun toString(): String {
val descriptorName = when (descriptor) {
is ReceiverParameterDescriptor -> descriptor.containingDeclaration.name.toString() + "::this"
else -> descriptor.name
}
return "Variable(descriptor=$descriptorName, state=$state)"
}
}
interface Frame {
fun addVar(variable: Variable)
fun addAll(variables: List<Variable>)
@@ -0,0 +1,20 @@
/*
* Copyright 2010-2020 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.backend.common.interpreter.stack
import org.jetbrains.kotlin.backend.common.interpreter.state.State
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor
data class Variable(val descriptor: DeclarationDescriptor, val state: State) {
override fun toString(): String {
val descriptorName = when (descriptor) {
is ReceiverParameterDescriptor -> descriptor.containingDeclaration.name.toString() + "::this"
else -> descriptor.name
}
return "Variable(descriptor=$descriptorName, state=$state)"
}
}