Rename expression value parameter to declaration

This commit is contained in:
Ivan Kylchik
2021-02-02 15:59:43 +03:00
committed by TeamCityServer
parent e6254b51e1
commit 8617809528
2 changed files with 7 additions and 12 deletions
@@ -104,7 +104,7 @@ class IrInterpreter(val irBuiltIns: IrBuiltIns, private val bodyMap: Map<IdSigna
is IrCall -> interpretCall(this) is IrCall -> interpretCall(this)
is IrConstructorCall -> interpretConstructorCall(this) is IrConstructorCall -> interpretConstructorCall(this)
is IrEnumConstructorCall -> interpretEnumConstructorCall(this) is IrEnumConstructorCall -> interpretEnumConstructorCall(this)
is IrDelegatingConstructorCall -> interpretDelegatedConstructorCall(this) is IrDelegatingConstructorCall -> interpretDelegatingConstructorCall(this)
is IrInstanceInitializerCall -> interpretInstanceInitializerCall(this) is IrInstanceInitializerCall -> interpretInstanceInitializerCall(this)
is IrBody -> interpretBody(this) is IrBody -> interpretBody(this)
is IrBlock -> interpretBlock(this) is IrBlock -> interpretBlock(this)
@@ -442,7 +442,7 @@ class IrInterpreter(val irBuiltIns: IrBuiltIns, private val bodyMap: Map<IdSigna
return interpretConstructor(enumConstructorCall) return interpretConstructor(enumConstructorCall)
} }
private fun interpretDelegatedConstructorCall(delegatingConstructorCall: IrDelegatingConstructorCall): ExecutionResult { private fun interpretDelegatingConstructorCall(delegatingConstructorCall: IrDelegatingConstructorCall): ExecutionResult {
if (delegatingConstructorCall.symbol.owner.parent == irBuiltIns.anyClass.owner) { if (delegatingConstructorCall.symbol.owner.parent == irBuiltIns.anyClass.owner) {
val anyAsStateObject = Common(irBuiltIns.anyClass.owner) val anyAsStateObject = Common(irBuiltIns.anyClass.owner)
stack.pushReturnValue(anyAsStateObject) stack.pushReturnValue(anyAsStateObject)
@@ -605,12 +605,12 @@ class IrInterpreter(val irBuiltIns: IrBuiltIns, private val bodyMap: Map<IdSigna
return Next return Next
} }
private fun interpretVariable(expression: IrVariable): ExecutionResult { private fun interpretVariable(declaration: IrVariable): ExecutionResult {
if (expression.initializer == null) { if (declaration.initializer == null) {
return Next.apply { stack.addVar(Variable(expression.symbol)) } return Next.apply { stack.addVar(Variable(declaration.symbol)) }
} }
expression.initializer?.interpret()?.check { return it } //?: return Next declaration.initializer?.interpret()?.check { return it } //?: return Next
stack.addVar(Variable(expression.symbol, stack.popReturnValue())) stack.addVar(Variable(declaration.symbol, stack.popReturnValue()))
return Next return Next
} }
@@ -151,11 +151,6 @@ internal class StackImpl : Stack {
} }
private class FrameContainer(val irFile: IrFile? = null, private val entryPoint: IrFunction? = null, current: Frame = InterpreterFrame()) { private class FrameContainer(val irFile: IrFile? = null, private val entryPoint: IrFunction? = null, current: Frame = InterpreterFrame()) {
/*var lineNumber: Int
get() = getTopFrame().lineOfCall
set(value) {
getTopFrame().lineOfCall = value
}*/
var lineNumber: Int = -1 var lineNumber: Int = -1
private val innerStack = mutableListOf(current) private val innerStack = mutableListOf(current)
private fun getTopFrame() = innerStack.first() private fun getTopFrame() = innerStack.first()