NO_RECEIVER_PARAMETER is now simply null

This commit is contained in:
Andrey Breslav
2012-11-01 16:34:44 +04:00
parent a325d86e20
commit ec255e8342
62 changed files with 194 additions and 264 deletions
@@ -233,7 +233,7 @@ public final class StaticContext {
boolean isGetter = descriptor instanceof PropertyGetterDescriptor;
String accessorName = Namer.getNameForAccessor(propertyName, isGetter,
!accessorDescriptor.getReceiverParameter().exists() && isEcma5());
accessorDescriptor.getReceiverParameter() == null && isEcma5());
return declareName(descriptor, accessorName);
}
};
@@ -70,7 +70,7 @@ class InnerFunctionTranslator extends InnerDeclarationTranslator {
@NotNull
private JsExpression getThis() {
ClassDescriptor outerClassDescriptor = closureContext.outerClassDescriptor;
if (outerClassDescriptor != null && !descriptor.getReceiverParameter().exists()) {
if (outerClassDescriptor != null && descriptor.getReceiverParameter() == null) {
return JsLiteral.THIS;
}
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.TemporaryBindingTrace;
import org.jetbrains.jet.lang.resolve.calls.tasks.ExplicitReceiverKind;
import org.jetbrains.jet.lang.resolve.calls.tasks.ResolutionCandidate;
@@ -107,8 +108,8 @@ public final class CallBuilder {
private CallTranslator finish() {
if (resolvedCall == null) {
assert descriptor != null;
resolvedCall = ResolvedCallImpl.create(ResolutionCandidate.create(descriptor, descriptor.getExpectedThisObject().getValue(),
descriptor.getReceiverParameter().getValue(),
resolvedCall = ResolvedCallImpl.create(ResolutionCandidate.create(descriptor, DescriptorUtils.safeGetValue(descriptor.getExpectedThisObject()),
DescriptorUtils.safeGetValue(descriptor.getReceiverParameter()),
ExplicitReceiverKind.THIS_OBJECT, false),
TemporaryBindingTrace.create(new BindingTraceContext(), "trace to resolve call (in js)"));
}
@@ -102,7 +102,7 @@ public final class NativePropertyAccessTranslator extends PropertyAccessTranslat
if (receiver != null) {
return receiver;
}
assert !propertyDescriptor.getReceiverParameter().exists() : "Can't have native extension properties.";
assert propertyDescriptor.getReceiverParameter() == null : "Can't have native extension properties.";
DeclarationDescriptor expectedThisDescriptor = getExpectedThisDescriptor(propertyDescriptor);
if (expectedThisDescriptor == null) {
return null;
@@ -85,14 +85,14 @@ public final class JsDescriptorUtils {
}
public static boolean isExtension(@NotNull CallableDescriptor functionDescriptor) {
return (functionDescriptor.getReceiverParameter().exists());
return (functionDescriptor.getReceiverParameter() != null);
}
//TODO: why callable descriptor
@Nullable
public static DeclarationDescriptor getExpectedThisDescriptor(@NotNull CallableDescriptor callableDescriptor) {
ReceiverParameterDescriptor expectedThisObject = callableDescriptor.getExpectedThisObject();
if (!expectedThisObject.exists()) {
if (expectedThisObject == null) {
return null;
}
return getDeclarationDescriptorForReceiver(expectedThisObject.getValue());
@@ -111,7 +111,7 @@ public final class JsDescriptorUtils {
@Nullable
public static DeclarationDescriptor getExpectedReceiverDescriptor(@NotNull CallableDescriptor callableDescriptor) {
ReceiverParameterDescriptor receiverParameter = callableDescriptor.getReceiverParameter();
if (!receiverParameter.exists()) {
if (receiverParameter == null) {
return null;
}
return getDeclarationDescriptorForReceiver(receiverParameter.getValue());