Reused utility method getDirectMember.

This commit is contained in:
Evgeny Gerashchenko
2014-07-10 17:31:52 +04:00
parent 708816f09c
commit 42e3ad3ccf
3 changed files with 5 additions and 13 deletions
@@ -21,7 +21,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.codegen.state.JetTypeMapper;
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.jet.descriptors.serialization.descriptors.DeserializedPropertyDescriptor;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.descriptors.annotations.Annotated;
import org.jetbrains.jet.lang.descriptors.annotations.AnnotationArgumentVisitor;
@@ -119,9 +118,8 @@ public abstract class AnnotationCodegen {
Set<String> annotationDescriptorsAlreadyPresent = new HashSet<String>();
if (modifierList == null) {
if (annotated instanceof DeserializedCallableMemberDescriptor ||
annotated instanceof PropertyAccessorDescriptor &&
((PropertyAccessorDescriptor) annotated).getCorrespondingProperty() instanceof DeserializedPropertyDescriptor) {
if (annotated instanceof CallableMemberDescriptor &&
JvmCodegenUtil.getDirectMember((CallableMemberDescriptor) annotated) instanceof DeserializedCallableMemberDescriptor) {
for (AnnotationDescriptor annotation : annotated.getAnnotations()) {
String descriptor = genAnnotation(annotation);
if (descriptor != null) {
@@ -18,6 +18,7 @@ package org.jetbrains.jet.codegen.context;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.codegen.JvmCodegenUtil;
import org.jetbrains.jet.codegen.OwnerKind;
import org.jetbrains.jet.codegen.StackValue;
import org.jetbrains.jet.codegen.binding.MutableClosure;
@@ -37,9 +38,7 @@ public class MethodContext extends CodegenContext<CallableMemberDescriptor> {
@Nullable MutableClosure closure,
boolean isInliningLambda
) {
super(contextDescriptor instanceof PropertyAccessorDescriptor
? ((PropertyAccessorDescriptor) contextDescriptor).getCorrespondingProperty()
: contextDescriptor, contextKind, parentContext, closure,
super(JvmCodegenUtil.getDirectMember(contextDescriptor), contextKind, parentContext, closure,
parentContext.hasThisDescriptor() ? parentContext.getThisDescriptor() : null, null);
this.isInliningLambda = isInliningLambda;
}
@@ -581,12 +581,7 @@ public class JetTypeMapper {
writeVoidReturn(sw);
}
else {
if (f instanceof PropertyAccessorDescriptor) {
writeFormalTypeParameters(((PropertyAccessorDescriptor) f).getCorrespondingProperty().getTypeParameters(), sw);
}
else {
writeFormalTypeParameters(f.getTypeParameters(), sw);
}
writeFormalTypeParameters(getDirectMember(f).getTypeParameters(), sw);
sw.writeParametersStart();
writeThisIfNeeded(f, kind, sw);