Refactor ASM generation code #105
@ -98,7 +98,7 @@ internal class AsmBinaryOperation<T>(
|
|||||||
|
|
||||||
internal class AsmVariableExpression<T>(private val name: String, private val default: T? = null) :
|
internal class AsmVariableExpression<T>(private val name: String, private val default: T? = null) :
|
||||||
AsmNode<T>() {
|
AsmNode<T>() {
|
||||||
override fun compile(gen: AsmGenerator<T>): Unit = gen.loadFromVariables(name, default)
|
override fun compile(gen: AsmGenerator<T>): Unit = gen.loadVariable(name, default)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal class AsmConstantExpression<T>(private val value: T) :
|
internal class AsmConstantExpression<T>(private val value: T) :
|
||||||
|
@ -228,7 +228,7 @@ internal class AsmGenerator<T> @PublishedApi internal constructor(
|
|||||||
loadConstant(value, c)
|
loadConstant(value, c)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun loadFromVariables(name: String, defaultValue: T? = null): Unit = invokeMethodVisitor.run {
|
internal fun loadVariable(name: String, defaultValue: T? = null): Unit = invokeMethodVisitor.run {
|
||||||
visitLoadObjectVar(invokeArgumentsVar)
|
visitLoadObjectVar(invokeArgumentsVar)
|
||||||
|
|
||||||
if (defaultValue != null) {
|
if (defaultValue != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user