more descriptorToDeclaration utils
* custom versions * normalization code moved out of norializer * hide DESCRIPTOR_TO_DECLARATION (make package local)
This commit is contained in:
@@ -1434,8 +1434,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> {
|
||||
public StackValue generateThisOrOuter(ClassDescriptor calleeContainingClass) {
|
||||
CodegenContext cur = context;
|
||||
|
||||
PsiElement psiElement = BindingContextUtils.descriptorToDeclaration(bindingContext, calleeContainingClass);
|
||||
boolean isObject = psiElement instanceof JetClassOrObject && CodegenUtil.isNonLiteralObject((JetClassOrObject)psiElement);
|
||||
PsiElement psiElement = BindingContextUtils.classDescriptorToDeclaration(bindingContext, calleeContainingClass);
|
||||
boolean isObject = psiElement instanceof JetClassOrObject && CodegenUtil.isNonLiteralObject((JetClassOrObject) psiElement);
|
||||
|
||||
cur = context;
|
||||
StackValue result = StackValue.local(0, TYPE_OBJECT);
|
||||
|
||||
@@ -440,7 +440,7 @@ public class FunctionCodegen {
|
||||
|
||||
iv.areturn(jvmSignature.getReturnType());
|
||||
|
||||
endVisit(mv, "default method", BindingContextUtils.descriptorToDeclaration(state.getBindingContext(), functionDescriptor));
|
||||
endVisit(mv, "default method", BindingContextUtils.callableDescriptorToDeclaration(state.getBindingContext(), functionDescriptor));
|
||||
mv.visitEnd();
|
||||
}
|
||||
}
|
||||
@@ -500,7 +500,7 @@ public class FunctionCodegen {
|
||||
if(jvmSignature.getReturnType() == Type.VOID_TYPE)
|
||||
iv.aconst(null);
|
||||
iv.areturn(overriden.getReturnType());
|
||||
endVisit(mv, "bridge method", BindingContextUtils.descriptorToDeclaration(state.getBindingContext(), functionDescriptor));
|
||||
endVisit(mv, "bridge method", BindingContextUtils.callableDescriptorToDeclaration(state.getBindingContext(), functionDescriptor));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,7 +634,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
StackValue field = StackValue.field(fieldType, classname, delegateField, false);
|
||||
field.store(iv);
|
||||
|
||||
JetClass superClass = (JetClass) BindingContextUtils.descriptorToDeclaration(bindingContext, superClassDescriptor);
|
||||
JetClass superClass = (JetClass) BindingContextUtils.classDescriptorToDeclaration(bindingContext, superClassDescriptor);
|
||||
final CodegenContext delegateContext = context.intoClass(superClassDescriptor,
|
||||
new OwnerKind.DelegateKind(StackValue.field(fieldType, classname, delegateField, false),
|
||||
typeMapper.mapType(superClassDescriptor.getDefaultType(), MapTypeMode.IMPL).getInternalName()), state.getInjector().getJetTypeMapper());
|
||||
@@ -723,7 +723,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
DeclarationDescriptor containingDeclaration = fun.getContainingDeclaration();
|
||||
if(containingDeclaration instanceof ClassDescriptor) {
|
||||
ClassDescriptor declaration = (ClassDescriptor) containingDeclaration;
|
||||
PsiElement psiElement = BindingContextUtils.descriptorToDeclaration(bindingContext, declaration);
|
||||
PsiElement psiElement = BindingContextUtils.classDescriptorToDeclaration(bindingContext, declaration);
|
||||
if(psiElement instanceof JetClass) {
|
||||
JetClass jetClass = (JetClass) psiElement;
|
||||
if(jetClass.isTrait()) {
|
||||
@@ -765,7 +765,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen {
|
||||
iv.checkcast(function.getReturnType());
|
||||
}
|
||||
iv.areturn(function.getReturnType());
|
||||
FunctionCodegen.endVisit(iv, "trait method", BindingContextUtils.descriptorToDeclaration(bindingContext, fun));
|
||||
FunctionCodegen.endVisit(iv, "trait method", BindingContextUtils.callableDescriptorToDeclaration(bindingContext, fun));
|
||||
}
|
||||
|
||||
FunctionCodegen.generateBridgeIfNeeded(context, state, v, function, fun, kind);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ObjectOrClosureCodegen {
|
||||
final int idx = exprContext.lookupLocal(vd);
|
||||
if (idx < 0) return null;
|
||||
|
||||
JetElement expression = (JetElement) BindingContextUtils.descriptorToDeclaration(state.getBindingContext(), vd);
|
||||
JetElement expression = (JetElement) BindingContextUtils.callableDescriptorToDeclaration(state.getBindingContext(), vd);
|
||||
String cn = state.getInjector().getJetTypeMapper().getClosureAnnotator().classNameForAnonymousClass(expression);
|
||||
Type localType = Type.getObjectType(cn);
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class TraitImplBodyCodegen extends ClassBodyCodegen {
|
||||
|
||||
//todo not needed when frontend will be able to calculate properly
|
||||
static JetType getSuperClass(ClassDescriptor myClassDescr, BindingContext bindingContext) {
|
||||
JetClassOrObject myClass = (JetClassOrObject) BindingContextUtils.descriptorToDeclaration(bindingContext, myClassDescr);
|
||||
JetClassOrObject myClass = (JetClassOrObject) BindingContextUtils.classDescriptorToDeclaration(bindingContext, myClassDescr);
|
||||
if(myClass == null)
|
||||
return JetStandardClasses.getAnyType();
|
||||
List<JetDelegationSpecifier> delegationSpecifiers = myClass.getDelegationSpecifiers();
|
||||
@@ -44,7 +44,7 @@ public class TraitImplBodyCodegen extends ClassBodyCodegen {
|
||||
if (specifier instanceof JetDelegatorToSuperClass || specifier instanceof JetDelegatorToSuperCall) {
|
||||
JetType superType = bindingContext.get(BindingContext.TYPE, specifier.getTypeReference());
|
||||
ClassDescriptor superClassDescriptor = (ClassDescriptor) superType.getConstructor().getDeclarationDescriptor();
|
||||
final PsiElement declaration = BindingContextUtils.descriptorToDeclaration(bindingContext, superClassDescriptor);
|
||||
final PsiElement declaration = BindingContextUtils.classDescriptorToDeclaration(bindingContext, superClassDescriptor);
|
||||
if (declaration != null) {
|
||||
if (declaration instanceof PsiClass) {
|
||||
if (!((PsiClass) declaration).isInterface()) {
|
||||
|
||||
Reference in New Issue
Block a user