001/*
002 * Copyright 2010-2013 JetBrains s.r.o.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.jetbrains.jet.lang.resolve.calls.tasks;
018
019public enum ExplicitReceiverKind {
020    RECEIVER_ARGUMENT,
021    THIS_OBJECT,
022    NO_EXPLICIT_RECEIVER,
023
024    // A very special case.
025    // In a call 'b.foo(1)' where class 'Foo' has an extension member 'fun B.invoke(Int)' function 'invoke' has two explicit receivers:
026    // 'b' (as receiver argument) and 'foo' (as this object).
027    BOTH_RECEIVERS;
028
029    public boolean isReceiver() {
030        return this == RECEIVER_ARGUMENT || this == BOTH_RECEIVERS;
031    }
032
033    public boolean isThisObject() {
034        return this == THIS_OBJECT || this == BOTH_RECEIVERS;
035    }
036}