Fixes after review

This commit is contained in:
Ilya Chernikov
2018-07-06 16:36:07 +02:00
parent 5d597eb382
commit 9549736d35
6 changed files with 26 additions and 40 deletions
@@ -111,12 +111,10 @@ class ScriptCodegen private constructor(
fun genFieldFromArrayElement(descriptor: ClassDescriptor, paramIndex: Int, elementIndex: Int, name: String) {
val elementClassType = typeMapper.mapClass(descriptor)
iv.load(0, classType)
iv.load(paramIndex, elementClassType)
iv.aconst(elementIndex)
iv.aload(OBJECT_TYPE)
iv.checkcast(elementClassType)
iv.putfield(classType.internalName, name, elementClassType.descriptor)
val array = StackValue.local(paramIndex, AsmUtil.getArrayType(OBJECT_TYPE))
val value = StackValue.arrayElement(OBJECT_TYPE, null, array, StackValue.constant(elementIndex, Type.INT_TYPE))
val field = StackValue.field(elementClassType, classType, name, false, StackValue.local(0, classType))
field.store(value, iv)
}
if (!scriptContext.earlierScripts.isEmpty()) {