use of com.perl5.lang.perl.psi.utils.PerlResolveUtil in project Perl5-IDEA by Camelcade.
the class PerlVariableMixin method getGlobalDeclarations.
// fixme this need to be moved to PerlResolveUtil or Resolver
@Override
public List<PerlVariableDeclarationElement> getGlobalDeclarations() {
List<PerlVariableDeclarationElement> result = new ArrayList<>();
PerlVariableType myType = getActualType();
// wrapper if any
PsiElement parent = getParent();
if (myType == PerlVariableType.SCALAR) {
for (PerlVariableDeclarationElement variable : PerlScalarUtil.getGlobalScalarDefinitions(getProject(), getCanonicalName())) {
if (!variable.equals(parent)) {
result.add(variable);
}
}
} else if (myType == PerlVariableType.ARRAY) {
for (PerlVariableDeclarationElement variable : PerlArrayUtil.getGlobalArrayDefinitions(getProject(), getCanonicalName())) {
if (!variable.equals(parent)) {
result.add(variable);
}
}
} else if (myType == PerlVariableType.HASH) {
for (PerlVariableDeclarationElement variable : PerlHashUtil.getGlobalHashDefinitions(getProject(), getCanonicalName())) {
if (!variable.equals(parent)) {
result.add(variable);
}
}
}
return result;
}
Aggregations