Search in sources :

Example 6 with CFIdentifier

use of cfml.parsing.cfscript.CFIdentifier in project CFLint by cflint.

the class ArgVarChecker method checkFullExpression.

private boolean checkFullExpression(final Context context, final CFFullVarExpression fullVarExpr) {
    if (fullVarExpr.getExpressions().size() > 1 && fullVarExpr.getExpressions().get(0) instanceof CFIdentifier) {
        final CFIdentifier cfIdentifier1 = (CFIdentifier) fullVarExpr.getExpressions().get(0);
        if ("arguments".equalsIgnoreCase(cfIdentifier1.getName()) && fullVarExpr.getExpressions().get(1) instanceof CFIdentifier) {
            final CFIdentifier cfIdentifier2 = (CFIdentifier) fullVarExpr.getExpressions().get(1);
            final String name = cfIdentifier2.getName();
            if (context.getCallStack().isVariable(name)) {
                final String fileKey = context.fileFunctionString();
                if (alreadyReportedFullExpression.contains(fileKey)) {
                    return true;
                } else {
                    alreadyReportedFullExpression.add(fileKey);
                }
                context.addMessage("ARG_VAR_MIXED", name);
            }
        }
    }
    return false;
}
Also used : CFIdentifier(cfml.parsing.cfscript.CFIdentifier)

Aggregations

CFIdentifier (cfml.parsing.cfscript.CFIdentifier)6 CFExpression (cfml.parsing.cfscript.CFExpression)5 CFFullVarExpression (cfml.parsing.cfscript.CFFullVarExpression)4 CFVarDeclExpression (cfml.parsing.cfscript.CFVarDeclExpression)3 CFMember (cfml.parsing.cfscript.CFMember)2 ParseException (cfml.parsing.reporting.ParseException)2 CFLintScanException (com.cflint.exception.CFLintScanException)2 CFLintScanner (com.cflint.plugins.CFLintScanner)2 Context (com.cflint.plugins.Context)2 ContextMessage (com.cflint.plugins.Context.ContextMessage)2 IOException (java.io.IOException)2 CFArrayExpression (cfml.parsing.cfscript.CFArrayExpression)1 CFAssignmentExpression (cfml.parsing.cfscript.CFAssignmentExpression)1 CFFunctionExpression (cfml.parsing.cfscript.CFFunctionExpression)1 CFLiteral (cfml.parsing.cfscript.CFLiteral)1 CFStringExpression (cfml.parsing.cfscript.CFStringExpression)1 CFStructElementExpression (cfml.parsing.cfscript.CFStructElementExpression)1 CFTernaryExpression (cfml.parsing.cfscript.CFTernaryExpression)1 CFCase (cfml.parsing.cfscript.script.CFCase)1 CFCatchStatement (cfml.parsing.cfscript.script.CFCatchStatement)1