001 /* 002 * Copyright 2010-2015 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 017 package org.jetbrains.kotlin.resolve.calls.tasks; 018 019 public enum ExplicitReceiverKind { 020 EXTENSION_RECEIVER, 021 DISPATCH_RECEIVER, 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 extension receiver) and 'foo' (as dispatch receiver). 027 BOTH_RECEIVERS; 028 029 public boolean isExtensionReceiver() { 030 return this == EXTENSION_RECEIVER || this == BOTH_RECEIVERS; 031 } 032 033 public boolean isDispatchReceiver() { 034 return this == DISPATCH_RECEIVER || this == BOTH_RECEIVERS; 035 } 036 }