Fix for KT-5937: Receiver of javaClass-property hasn't been generated

#KT-5937 Fixed
This commit is contained in:
Michael Bogdanov
2014-10-07 10:59:31 +04:00
parent 1e9718f55b
commit 212d3da950
4 changed files with 55 additions and 1 deletions
@@ -358,6 +358,10 @@ public abstract class StackValue {
return field(info.getFieldType(), Type.getObjectType(info.getOwnerInternalName()), info.getFieldName(), true);
}
public static boolean couldSkipReceiverOnStaticCall(StackValue value) {
return value instanceof Local || value instanceof Constant;
}
private static class None extends StackValue {
public static final None INSTANCE = new None();
@@ -19,6 +19,7 @@ package org.jetbrains.jet.codegen.intrinsics;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.codegen.AsmUtil;
import org.jetbrains.jet.codegen.ExpressionCodegen;
import org.jetbrains.jet.codegen.StackValue;
import org.jetbrains.jet.lang.psi.JetExpression;
@@ -44,6 +45,10 @@ public class JavaClassProperty extends IntrinsicMethod {
) {
Type type = receiver.type;
if (isPrimitive(type)) {
if (!StackValue.couldSkipReceiverOnStaticCall(receiver)) {
receiver.put(type, v);
AsmUtil.pop(v, type);
}
v.getstatic(boxType(type).getInternalName(), "TYPE", "Ljava/lang/Class;");
}
else {