rename CodegenContext.contextType to contextDescriptor to match getter name

This commit is contained in:
Stepan Koltsov
2012-06-05 22:56:25 +04:00
parent 4cf48d64a7
commit 6c12aa8605
2 changed files with 24 additions and 24 deletions
@@ -38,7 +38,7 @@ import java.util.LinkedHashMap;
public abstract class CodegenContext { public abstract class CodegenContext {
@NotNull @NotNull
private final DeclarationDescriptor contextType; private final DeclarationDescriptor contextDescriptor;
private final OwnerKind contextKind; private final OwnerKind contextKind;
@Nullable @Nullable
@@ -54,8 +54,8 @@ public abstract class CodegenContext {
protected Type outerWasUsed ; protected Type outerWasUsed ;
public CodegenContext(@NotNull DeclarationDescriptor contextType, OwnerKind contextKind, @Nullable CodegenContext parentContext, @Nullable ObjectOrClosureCodegen closureCodegen) { public CodegenContext(@NotNull DeclarationDescriptor contextDescriptor, OwnerKind contextKind, @Nullable CodegenContext parentContext, @Nullable ObjectOrClosureCodegen closureCodegen) {
this.contextType = contextType; this.contextDescriptor = contextDescriptor;
this.contextKind = contextKind; this.contextKind = contextKind;
this.parentContext = parentContext; this.parentContext = parentContext;
closure = closureCodegen; closure = closureCodegen;
@@ -90,11 +90,11 @@ public abstract class CodegenContext {
} }
public DeclarationDescriptor getContextDescriptor() { public DeclarationDescriptor getContextDescriptor() {
return contextType; return contextDescriptor;
} }
public String getNamespaceClassName() { public String getNamespaceClassName() {
DeclarationDescriptor descriptor = contextType; DeclarationDescriptor descriptor = contextDescriptor;
while(!(descriptor instanceof NamespaceDescriptor)) { while(!(descriptor instanceof NamespaceDescriptor)) {
descriptor = descriptor.getContainingDeclaration(); descriptor = descriptor.getContainingDeclaration();
} }
@@ -206,7 +206,7 @@ public abstract class CodegenContext {
if (accessor != null) { return accessor; } if (accessor != null) { return accessor; }
if(descriptor instanceof SimpleFunctionDescriptor) { if(descriptor instanceof SimpleFunctionDescriptor) {
SimpleFunctionDescriptorImpl myAccessor = new SimpleFunctionDescriptorImpl(contextType, SimpleFunctionDescriptorImpl myAccessor = new SimpleFunctionDescriptorImpl(contextDescriptor,
Collections.<AnnotationDescriptor>emptyList(), Collections.<AnnotationDescriptor>emptyList(),
Name.identifier(descriptor.getName() + "$bridge$" + accessors.size()), Name.identifier(descriptor.getName() + "$bridge$" + accessors.size()),
CallableMemberDescriptor.Kind.DECLARATION); CallableMemberDescriptor.Kind.DECLARATION);
@@ -223,7 +223,7 @@ public abstract class CodegenContext {
} }
else if(descriptor instanceof PropertyDescriptor) { else if(descriptor instanceof PropertyDescriptor) {
PropertyDescriptor pd = (PropertyDescriptor) descriptor; PropertyDescriptor pd = (PropertyDescriptor) descriptor;
PropertyDescriptor myAccessor = new PropertyDescriptor(contextType, PropertyDescriptor myAccessor = new PropertyDescriptor(contextDescriptor,
Collections.<AnnotationDescriptor>emptyList(), Collections.<AnnotationDescriptor>emptyList(),
pd.getModality(), pd.getModality(),
pd.getVisibility(), pd.getVisibility(),
@@ -99,9 +99,9 @@ public class CodegenContexts {
public abstract static class ReceiverContext extends CodegenContext { public abstract static class ReceiverContext extends CodegenContext {
final CallableDescriptor receiverDescriptor; final CallableDescriptor receiverDescriptor;
public ReceiverContext(CallableDescriptor contextType, OwnerKind contextKind, CodegenContext parentContext, @Nullable ObjectOrClosureCodegen closureCodegen) { public ReceiverContext(CallableDescriptor contextDescriptor, OwnerKind contextKind, CodegenContext parentContext, @Nullable ObjectOrClosureCodegen closureCodegen) {
super(contextType, contextKind, parentContext, closureCodegen); super(contextDescriptor, contextKind, parentContext, closureCodegen);
receiverDescriptor = contextType.getReceiverParameter().exists() ? contextType : null; receiverDescriptor = contextDescriptor.getReceiverParameter().exists() ? contextDescriptor : null;
} }
@Override @Override
@@ -144,8 +144,8 @@ public class CodegenContexts {
} }
public static class ConstructorContext extends MethodContext { public static class ConstructorContext extends MethodContext {
public ConstructorContext(ConstructorDescriptor contextType, OwnerKind kind, CodegenContext parent, JetTypeMapper typeMapper) { public ConstructorContext(ConstructorDescriptor contextDescriptor, OwnerKind kind, CodegenContext parent, JetTypeMapper typeMapper) {
super(contextType, kind, parent); super(contextDescriptor, kind, parent);
final Type type = enclosingClassType(typeMapper); final Type type = enclosingClassType(typeMapper);
outerExpression = type != null outerExpression = type != null
@@ -166,11 +166,11 @@ public class CodegenContexts {
public static class ScriptContext extends CodegenContext { public static class ScriptContext extends CodegenContext {
public ScriptContext( public ScriptContext(
@NotNull DeclarationDescriptor contextType, @NotNull DeclarationDescriptor contextDescriptor,
@NotNull OwnerKind contextKind, @NotNull OwnerKind contextKind,
@Nullable CodegenContext parentContext, @Nullable CodegenContext parentContext,
@Nullable ObjectOrClosureCodegen closureCodegen) { @Nullable ObjectOrClosureCodegen closureCodegen) {
super(contextType, contextKind, parentContext, closureCodegen); super(contextDescriptor, contextKind, parentContext, closureCodegen);
} }
@Override @Override
@@ -185,12 +185,12 @@ public class CodegenContexts {
} }
public static class ClassContext extends CodegenContext { public static class ClassContext extends CodegenContext {
public ClassContext(ClassDescriptor contextType, OwnerKind contextKind, CodegenContext parentContext, JetTypeMapper typeMapper) { public ClassContext(ClassDescriptor contextDescriptor, OwnerKind contextKind, CodegenContext parentContext, JetTypeMapper typeMapper) {
super(contextType, contextKind, parentContext, null); super(contextDescriptor, contextKind, parentContext, null);
final Type type = enclosingClassType(typeMapper); final Type type = enclosingClassType(typeMapper);
outerExpression = type != null outerExpression = type != null
? StackValue.field(type, typeMapper.getClassFQName(contextType), "this$0", false) ? StackValue.field(type, typeMapper.getClassFQName(contextDescriptor), "this$0", false)
: null; : null;
} }
@@ -206,11 +206,11 @@ public class CodegenContexts {
} }
public static class AnonymousClassContext extends CodegenContext { public static class AnonymousClassContext extends CodegenContext {
public AnonymousClassContext(ClassDescriptor contextType, OwnerKind contextKind, CodegenContext parentContext, @NotNull ObjectOrClosureCodegen closure, JetTypeMapper typeMapper) { public AnonymousClassContext(ClassDescriptor contextDescriptor, OwnerKind contextKind, CodegenContext parentContext, @NotNull ObjectOrClosureCodegen closure, JetTypeMapper typeMapper) {
super(contextType, contextKind, parentContext, closure); super(contextDescriptor, contextKind, parentContext, closure);
final Type type = enclosingClassType(typeMapper); final Type type = enclosingClassType(typeMapper);
Type owner = closure.state.getInjector().getJetTypeMapper().mapType(contextType.getDefaultType(), MapTypeMode.IMPL); Type owner = closure.state.getInjector().getJetTypeMapper().mapType(contextDescriptor.getDefaultType(), MapTypeMode.IMPL);
outerExpression = type != null outerExpression = type != null
? StackValue.field(type, JvmClassName.byType(owner), "this$0", false) ? StackValue.field(type, JvmClassName.byType(owner), "this$0", false)
: null; : null;
@@ -235,8 +235,8 @@ public class CodegenContexts {
public static class ClosureContext extends ReceiverContext { public static class ClosureContext extends ReceiverContext {
private ClassDescriptor classDescriptor; private ClassDescriptor classDescriptor;
public ClosureContext(FunctionDescriptor contextType, ClassDescriptor classDescriptor, CodegenContext parentContext, @NotNull ObjectOrClosureCodegen closureCodegen, JvmClassName internalClassName, JetTypeMapper typeMapper) { public ClosureContext(FunctionDescriptor contextDescriptor, ClassDescriptor classDescriptor, CodegenContext parentContext, @NotNull ObjectOrClosureCodegen closureCodegen, JvmClassName internalClassName, JetTypeMapper typeMapper) {
super(contextType, OwnerKind.IMPLEMENTATION, parentContext, closureCodegen); super(contextDescriptor, OwnerKind.IMPLEMENTATION, parentContext, closureCodegen);
this.classDescriptor = classDescriptor; this.classDescriptor = classDescriptor;
final Type type = enclosingClassType(typeMapper); final Type type = enclosingClassType(typeMapper);
@@ -267,8 +267,8 @@ public class CodegenContexts {
} }
public static class NamespaceContext extends CodegenContext { public static class NamespaceContext extends CodegenContext {
public NamespaceContext(NamespaceDescriptor contextType, CodegenContext parent) { public NamespaceContext(NamespaceDescriptor contextDescriptor, CodegenContext parent) {
super(contextType, OwnerKind.NAMESPACE, parent, null); super(contextDescriptor, OwnerKind.NAMESPACE, parent, null);
} }
@Override @Override