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.psi;
018
019 import com.intellij.lang.ASTNode;
020 import org.jetbrains.annotations.NotNull;
021 import org.jetbrains.annotations.Nullable;
022 import org.jetbrains.kotlin.KtNodeTypes;
023
024 import java.util.Collections;
025 import java.util.List;
026
027 public class KtConstructorDelegationCall extends KtElementImpl implements KtCallElement {
028 public KtConstructorDelegationCall(@NotNull ASTNode node) {
029 super(node);
030 }
031
032 @Override
033 @Nullable
034 public KtValueArgumentList getValueArgumentList() {
035 return (KtValueArgumentList) findChildByType(KtNodeTypes.VALUE_ARGUMENT_LIST);
036 }
037
038 @Override
039 @NotNull
040 public List<? extends ValueArgument> getValueArguments() {
041 KtValueArgumentList list = getValueArgumentList();
042 return list != null ? list.getArguments() : Collections.<KtValueArgument>emptyList();
043 }
044
045 @NotNull
046 @Override
047 public List<KtLambdaArgument> getLambdaArguments() {
048 return Collections.emptyList();
049 }
050
051 @NotNull
052 @Override
053 public List<KtTypeProjection> getTypeArguments() {
054 return Collections.emptyList();
055 }
056
057 @Override
058 public KtTypeArgumentList getTypeArgumentList() {
059 return null;
060 }
061
062 @Nullable
063 @Override
064 public KtConstructorDelegationReferenceExpression getCalleeExpression() {
065 return findChildByClass(KtConstructorDelegationReferenceExpression.class);
066 }
067
068 public boolean isImplicit() {
069 KtConstructorDelegationReferenceExpression callee = getCalleeExpression();
070 return callee != null && callee.getFirstChild() == null;
071 }
072
073 public boolean isCallToThis() {
074 KtConstructorDelegationReferenceExpression callee = getCalleeExpression();
075 return callee != null && callee.isThis();
076 }
077 }