use of com.perl5.lang.perl.psi.PsiPerlVariableDeclarationLocal in project Perl5-IDEA by Camelcade.
the class PerlVariableShadowingInspection method checkDeclaration.
@Override
public void checkDeclaration(ProblemsHolder holder, PerlVariableDeclarationElement variableDeclarationWrapper) {
PerlVariable variable = variableDeclarationWrapper.getVariable();
PsiElement declarationContainer = variableDeclarationWrapper.getParent();
if (variable != null && !(declarationContainer instanceof PsiPerlVariableDeclarationLocal)) {
PerlVariableDeclarationElement lexicalDeclaration = PerlResolveUtil.getLexicalDeclaration(variable);
if (lexicalDeclaration instanceof PerlBuiltInVariable) {
registerProblem(holder, variable, PerlBundle.message("perl.inspection.shadows.builtin", lexicalDeclaration.getVariable().getLineNumber()));
} else if (lexicalDeclaration instanceof PerlImplicitVariableDeclaration) {
registerProblem(holder, variable, PerlBundle.message("perl.inspection.shadows.implicit", lexicalDeclaration.getVariable().getLineNumber()));
} else if (lexicalDeclaration != null) {
registerProblem(holder, variable, PerlBundle.message("perl.inspection.shadows.other", lexicalDeclaration.getVariable().getLineNumber()));
}
}
}
use of com.perl5.lang.perl.psi.PsiPerlVariableDeclarationLocal in project Perl5-IDEA by Camelcade.
the class PerlBuiltinVariableRedeclarationInspection method checkDeclaration.
public void checkDeclaration(ProblemsHolder holder, PerlVariableDeclarationElement variableDeclarationWrapper) {
PerlVariable variable = variableDeclarationWrapper.getVariable();
PsiElement declarationContainer = variableDeclarationWrapper.getParent();
if (variable != null && PerlBuiltInVariablesService.getInstance(variableDeclarationWrapper.getProject()).getVariableDeclaration(variable.getActualType(), variable.getName()) != null && !(declarationContainer instanceof PsiPerlVariableDeclarationLocal)) {
registerProblem(holder, variable, PerlBundle.message("perl.inspection.builtin.shadowing"));
}
}
Aggregations