Search in sources :

Example 11 with CFFuncDeclStatement

use of cfml.parsing.cfscript.script.CFFuncDeclStatement in project CFLint by cflint.

the class ArgTypeChecker method expression.

@Override
public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) {
    if (expression instanceof CFFuncDeclStatement) {
        final CFFuncDeclStatement function = (CFFuncDeclStatement) expression;
        for (final CFFunctionParameter argument : function.getFormals()) {
            final String name = argument.getName();
            final String variableType = argument.getType();
            if (variableType == null) {
                context.addMessage("ARG_TYPE_MISSING", name);
            } else if ("any".equals(variableType)) {
                context.addMessage("ARG_TYPE_ANY", name);
            }
        }
    }
}
Also used : CFFuncDeclStatement(cfml.parsing.cfscript.script.CFFuncDeclStatement) CFFunctionParameter(cfml.parsing.cfscript.script.CFFunctionParameter)

Example 12 with CFFuncDeclStatement

use of cfml.parsing.cfscript.script.CFFuncDeclStatement in project CFLint by cflint.

the class FunctionHintChecker method expression.

/**
 * Parse a CF function deceleration to see if it's missing a hint.
 */
@Override
public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) {
    if (expression instanceof CFFuncDeclStatement) {
        final CFFuncDeclStatement funcDeclStatement = (CFFuncDeclStatement) expression;
        final CFExpression hintAttribute = CFTool.convertMap(funcDeclStatement.getAttributes()).get("hint");
        if (hintAttribute == null) {
            checkHint(FUNCTION_HINT_MISSING, context.getFunctionName(), expression, context);
        }
    }
}
Also used : CFFuncDeclStatement(cfml.parsing.cfscript.script.CFFuncDeclStatement) CFExpression(cfml.parsing.cfscript.CFExpression)

Aggregations

CFFuncDeclStatement (cfml.parsing.cfscript.script.CFFuncDeclStatement)12 CFFunctionParameter (cfml.parsing.cfscript.script.CFFunctionParameter)6 CFExpression (cfml.parsing.cfscript.CFExpression)2 CFCase (cfml.parsing.cfscript.script.CFCase)2 CFForInStatement (cfml.parsing.cfscript.script.CFForInStatement)2 CFTryCatchStatement (cfml.parsing.cfscript.script.CFTryCatchStatement)2 CFIdentifier (cfml.parsing.cfscript.CFIdentifier)1 CFLiteral (cfml.parsing.cfscript.CFLiteral)1 CFStringExpression (cfml.parsing.cfscript.CFStringExpression)1 CFCatchStatement (cfml.parsing.cfscript.script.CFCatchStatement)1 CFCompDeclStatement (cfml.parsing.cfscript.script.CFCompDeclStatement)1 CFCompoundStatement (cfml.parsing.cfscript.script.CFCompoundStatement)1 CFExpressionStatement (cfml.parsing.cfscript.script.CFExpressionStatement)1 CFForStatement (cfml.parsing.cfscript.script.CFForStatement)1 CFIfStatement (cfml.parsing.cfscript.script.CFIfStatement)1 CFIncludeStatement (cfml.parsing.cfscript.script.CFIncludeStatement)1 CFPropertyStatement (cfml.parsing.cfscript.script.CFPropertyStatement)1 CFReturnStatement (cfml.parsing.cfscript.script.CFReturnStatement)1 CFScriptStatement (cfml.parsing.cfscript.script.CFScriptStatement)1 CFSwitchStatement (cfml.parsing.cfscript.script.CFSwitchStatement)1