2 * Copyright 2003-2005 Dave Griffith
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.siyeh
.ig
.psiutils
;
18 import com
.intellij
.psi
.*;
19 import org
.jetbrains
.annotations
.NotNull
;
21 public class VariableUsedInArrayInitializerVisitor
22 extends JavaRecursiveElementVisitor
{
25 private final PsiVariable variable
;
26 private boolean passed
= false;
28 public VariableUsedInArrayInitializerVisitor(@NotNull PsiVariable variable
){
30 this.variable
= variable
;
33 @Override public void visitElement(@NotNull PsiElement element
){
35 super.visitElement(element
);
39 @Override public void visitArrayInitializerExpression(
40 PsiArrayInitializerExpression expression
){
44 super.visitArrayInitializerExpression(expression
);
46 final PsiExpression
[] args
= expression
.getInitializers();
47 for(final PsiExpression arg
: args
){
49 if(VariableAccessUtils
.mayEvaluateToVariable(arg
, variable
)){
55 public boolean isPassed(){