Exemple #1
0
 @Nullable
 public static JetExpression getCalleeExpressionIfAny(@NotNull JetExpression expression) {
   if (expression instanceof JetSimpleNameExpression) {
     return expression;
   }
   if (expression instanceof JetCallElement) {
     JetCallElement callExpression = (JetCallElement) expression;
     return callExpression.getCalleeExpression();
   }
   if (expression instanceof JetQualifiedExpression) {
     JetExpression selectorExpression =
         ((JetQualifiedExpression) expression).getSelectorExpression();
     if (selectorExpression != null) {
       return getCalleeExpressionIfAny(selectorExpression);
     }
   }
   if (expression instanceof JetUnaryExpression) {
     return ((JetUnaryExpression) expression).getOperationReference();
   }
   if (expression instanceof JetBinaryExpression) {
     return ((JetBinaryExpression) expression).getOperationReference();
   }
   return null;
 }