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.psi; 018 019import com.intellij.lang.ASTNode; 020import org.jetbrains.annotations.NotNull; 021import org.jetbrains.annotations.Nullable; 022import org.jetbrains.jet.JetNodeTypes; 023 024import java.util.Collections; 025import java.util.List; 026 027public class JetDelegatorToSuperCall extends JetDelegationSpecifier implements JetCallElement { 028 public JetDelegatorToSuperCall(@NotNull ASTNode node) { 029 super(node); 030 } 031 032 @Override 033 public void accept(@NotNull JetVisitorVoid visitor) { 034 visitor.visitDelegationToSuperCallSpecifier(this); 035 } 036 037 @Override 038 public <R, D> R accept(@NotNull JetVisitor<R, D> visitor, D data) { 039 return visitor.visitDelegationToSuperCallSpecifier(this, data); 040 } 041 042 @NotNull 043 @Override 044 public JetConstructorCalleeExpression getCalleeExpression() { 045 return (JetConstructorCalleeExpression) findChildByType(JetNodeTypes.CONSTRUCTOR_CALLEE); 046 } 047 048 @Nullable 049 public JetValueArgumentList getValueArgumentList() { 050 return (JetValueArgumentList) findChildByType(JetNodeTypes.VALUE_ARGUMENT_LIST); 051 } 052 053 @NotNull 054 public List<? extends ValueArgument> getValueArguments() { 055 JetValueArgumentList list = getValueArgumentList(); 056 return list != null ? list.getArguments() : Collections.<JetValueArgument>emptyList(); 057 } 058 059 @NotNull 060 @Override 061 public List<JetExpression> getFunctionLiteralArguments() { 062 return Collections.emptyList(); 063 } 064 065 @Override 066 public JetTypeReference getTypeReference() { 067 return getCalleeExpression().getTypeReference(); 068 } 069 070 @NotNull 071 @Override 072 public List<JetTypeProjection> getTypeArguments() { 073 JetTypeArgumentList typeArgumentList = getTypeArgumentList(); 074 if (typeArgumentList == null) { 075 return Collections.emptyList(); 076 } 077 return typeArgumentList.getArguments(); 078 } 079 080 @Override 081 public JetTypeArgumentList getTypeArgumentList() { 082 JetUserType userType = getTypeAsUserType(); 083 return userType != null ? userType.getTypeArgumentList() : null; 084 } 085 086}