Introduced ParameterDescriptor type

This commit is contained in:
Michael Bogdanov
2015-04-23 14:00:38 +03:00
parent 53b8a1d56e
commit df2900c4e4
9 changed files with 49 additions and 38 deletions
@@ -0,0 +1,33 @@
/*
* Copyright 2010-2015 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.kotlin.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.types.JetType;
public interface ParameterDescriptor extends CallableDescriptor {
@NotNull
JetType getType();
@Override
@NotNull
DeclarationDescriptor getContainingDeclaration();
@NotNull
@Override
ParameterDescriptor getOriginal();
}
@@ -19,25 +19,17 @@ package org.jetbrains.kotlin.descriptors;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.JetType;
import org.jetbrains.kotlin.types.TypeSubstitutor;
public interface ReceiverParameterDescriptor extends CallableDescriptor {
public interface ReceiverParameterDescriptor extends ParameterDescriptor {
// This field exists for better readability of the client code
@Nullable
ReceiverParameterDescriptor NO_RECEIVER_PARAMETER = null;
@NotNull
JetType getType();
@NotNull
ReceiverValue getValue();
@Override
@NotNull
DeclarationDescriptor getContainingDeclaration();
@Nullable
@Override
ReceiverParameterDescriptor substitute(@NotNull TypeSubstitutor substitutor);
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.types.JetType;
import java.util.Set;
public interface ValueParameterDescriptor extends VariableDescriptor {
public interface ValueParameterDescriptor extends VariableDescriptor, ParameterDescriptor {
/**
* Returns the 0-based index of the value parameter in the parameter list of its containing function.
*
@@ -48,10 +48,6 @@ public interface ValueParameterDescriptor extends VariableDescriptor {
@Nullable JetType getVarargElementType();
@Override
@NotNull
JetType getType();
@NotNull
@Override
ValueParameterDescriptor getOriginal();
@@ -106,7 +106,7 @@ public abstract class AbstractReceiverParameterDescriptor extends DeclarationDes
@NotNull
@Override
public CallableDescriptor getOriginal() {
public ParameterDescriptor getOriginal() {
return this;
}