Fix assertions generation for substituted members

This commit is contained in:
Alexander Udalov
2013-02-04 22:40:54 +04:00
parent 4fa3909eaf
commit 8eb6047972
5 changed files with 69 additions and 1 deletions
@@ -571,7 +571,7 @@ public class AsmUtil {
) {
if (!state.isGenerateNotNullAssertions()) return;
if (!Boolean.TRUE.equals(state.getBindingContext().get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) return;
if (!isDeclaredInJava(descriptor, state.getBindingContext())) return;
JetType type = descriptor.getReturnType();
if (type == null || type.isNullable()) return;
@@ -585,6 +585,19 @@ public class AsmUtil {
}
}
private static boolean isDeclaredInJava(@NotNull CallableDescriptor callableDescriptor, @NotNull BindingContext context) {
CallableDescriptor descriptor = callableDescriptor;
while (true) {
if (Boolean.TRUE.equals(context.get(BindingContext.IS_DECLARED_IN_JAVA, descriptor))) {
return true;
}
CallableDescriptor original = descriptor.getOriginal();
if (descriptor == original) break;
descriptor = original;
}
return false;
}
public static void pushDefaultValueOnStack(@NotNull Type type, @NotNull InstructionAdapter v) {
if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
v.aconst(null);