Search in sources :

Example 1 with CFStructExpression

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

the class StructKeyChecker method expression.

@Override
public void expression(final CFExpression expression, final Context context, final BugList bugs) {
    if (expression instanceof CFStructExpression) {
        CFStructExpression structExpression = (CFStructExpression) expression;
        for (Object element : structExpression.getElements()) {
            CFStructElementExpression structKeyExpression = (CFStructElementExpression) element;
            String firstToken = structKeyExpression.getKey().getToken().getText();
            if (!"'".equals(firstToken) && !"\"".equals(firstToken)) {
                context.addMessage("UNQUOTED_STRUCT_KEY", structKeyExpression.getKey().Decompile(0));
            }
        }
    }
}
Also used : CFStructElementExpression(cfml.parsing.cfscript.CFStructElementExpression) CFStructExpression(cfml.parsing.cfscript.CFStructExpression)

Aggregations

CFStructElementExpression (cfml.parsing.cfscript.CFStructElementExpression)1 CFStructExpression (cfml.parsing.cfscript.CFStructExpression)1