Coercion fix

This commit is contained in:
Michael Bogdanov
2014-11-13 17:25:28 +03:00
parent c5d8f1faf5
commit 37bb4ae984
2 changed files with 4 additions and 7 deletions
@@ -390,8 +390,8 @@ public abstract class StackValue {
return new FieldForSharedVar(field.type, field.owner, field.name, newSharedVarReceiver);
}
public static StackValue coercion(@NotNull StackValue receiver, @NotNull Type type) {
return CodegenPackage.coercion(receiver, type);
public static StackValue coercion(@NotNull StackValue value, @NotNull Type castType) {
return new CoercionValue(value, castType);
}
public static StackValue thisOrOuter(@NotNull ExpressionCodegen codegen, @NotNull ClassDescriptor descriptor, boolean isSuper, boolean isExplicit) {
@@ -21,17 +21,14 @@ import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter
import org.jetbrains.org.objectweb.asm.Label
import org.jetbrains.jet.codegen.StackValue.StackValueWithSimpleReceiver
public fun coercion(value: StackValue, castType: Type): StackValue {
return CoercionValue(value, castType)
}
class CoercionValue(
val value: StackValue,
val castType: Type
) : StackValue(castType) {
override fun putSelector(type: Type, v: InstructionAdapter) {
value.putSelector(type, v)
value.putSelector(castType, v)
StackValue.coerce(castType, type, v)
}
override fun storeSelector(topOfStackType: Type, v: InstructionAdapter) {