Add assert messages

This commit is contained in:
Nikolay Krasko
2013-12-30 17:48:19 +04:00
parent 79cab1f1b6
commit 15c5a58b3a
2 changed files with 10 additions and 4 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2013 JetBrains s.r.o.
* Copyright 2010-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -171,7 +171,9 @@ class CodegenAnnotatingVisitor extends JetVisitorVoid {
@Override
public void visitClassObject(@NotNull JetClassObject classObject) {
ClassDescriptor classDescriptor = bindingContext.get(CLASS, classObject.getObjectDeclaration());
assert classDescriptor != null;
assert classDescriptor != null : String.format("No class found in binding context for: \n---\n%s\n---\n",
JetPsiUtil.getElementTextWithContext(classObject));
String name = peekFromStack(nameStack) + JvmAbi.CLASS_OBJECT_SUFFIX;
recordClosure(classObject, classDescriptor, name);
@@ -337,8 +337,12 @@ public class CodegenBinding {
}
for (JetDelegationSpecifier specifier : ((JetClassOrObject) classOrObject).getDelegationSpecifiers()) {
if (specifier instanceof JetDelegatorToSuperCall) {
JetType superType = bindingContext.get(TYPE, specifier.getTypeReference());
assert superType != null;
JetTypeReference typeReference = specifier.getTypeReference();
JetType superType = bindingContext.get(TYPE, typeReference);
assert superType != null: String.format(
"No type in binding context for \n---\n%s\n---\n", JetPsiUtil.getElementTextWithContext(specifier));
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
assert superClassDescriptor != null;
if (!isInterface(superClassDescriptor)) {