Use TypeUtils.isNullableType() in codegen

This commit is contained in:
Andrey Breslav
2014-09-02 18:19:53 +04:00
parent 1dbfe5483a
commit f5cc3e1a92
2 changed files with 3 additions and 2 deletions
@@ -220,7 +220,7 @@ public class JetTypeMapper {
if (descriptor instanceof ClassDescriptor) {
FqNameUnsafe className = DescriptorUtils.getFqName(descriptor);
if (className.isSafe()) {
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), jetType.isNullable());
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), TypeUtils.isNullableType(jetType));
}
}
@@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.constants.NullValue;
import org.jetbrains.jet.lang.types.JetType;
import org.jetbrains.jet.lang.types.TypeUtils;
import org.jetbrains.org.objectweb.asm.Label;
import org.jetbrains.org.objectweb.asm.Type;
import org.jetbrains.org.objectweb.asm.commons.InstructionAdapter;
@@ -135,7 +136,7 @@ abstract public class SwitchCodegen {
assert subjectJetType != null : "subject type can't be null (i.e. void)";
if (subjectJetType.isNullable()) {
if (TypeUtils.isNullableType(subjectJetType)) {
int nullEntryIndex = findNullEntryIndex(expression);
Label nullLabel = nullEntryIndex == -1 ? defaultLabel : entryLabels.get(nullEntryIndex);
Label notNullLabel = new Label();