mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
visitor for tuple expression
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -443,4 +443,8 @@ public abstract class GroovyElementVisitor {
|
||||
public void visitTypeParameter(GrTypeParameter typeParameter) {
|
||||
visitTypeDefinition(typeParameter);
|
||||
}
|
||||
|
||||
public void visitTupleExpression(GrTupleExpression tupleExpression) {
|
||||
visitExpression(tupleExpression);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,12 +17,14 @@
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author ilyas
|
||||
*/
|
||||
public interface GrTupleExpression extends GrExpression {
|
||||
int indexOf(PsiElement element);
|
||||
int indexOf(@NotNull PsiElement element);
|
||||
|
||||
@NotNull
|
||||
GrExpression[] getExpressions();
|
||||
}
|
||||
|
||||
+11
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,8 +20,9 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.ArrayUtilRt;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrTupleExpression;
|
||||
|
||||
@@ -44,12 +45,18 @@ public class GrTupleExpressionImpl extends GrExpressionImpl implements GrTupleEx
|
||||
}
|
||||
|
||||
@Override
|
||||
public int indexOf(PsiElement element) {
|
||||
public int indexOf(@NotNull PsiElement element) {
|
||||
GrExpression[] children = getExpressions();
|
||||
return ArrayUtil.find(children, element);
|
||||
return ArrayUtilRt.find(children, element);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public GrExpression[] getExpressions() {
|
||||
return findChildrenByClass(GrExpression.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(GroovyElementVisitor visitor) {
|
||||
visitor.visitTupleExpression(this);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user