Commit da123bec authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS checks: Add Hint about anonymous function formatting.

Migrated from QtChecker.

Change-Id: I0178cc189d1c98b51e1aeb43db7421ba8c43fc7e
Reviewed-on: http://codereview.qt-project.org/5856

Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@nokia.com>
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
parent 55713a15
......@@ -807,6 +807,16 @@ bool Check::visit(FunctionDeclaration *ast)
bool Check::visit(FunctionExpression *ast)
{
if (ast->name.isEmpty()) {
SourceLocation locfunc = ast->functionToken;
SourceLocation loclparen = ast->lparenToken;
if (locfunc.isValid() && loclparen.isValid()
&& (locfunc.startLine != loclparen.startLine
|| locfunc.end() + 1 != loclparen.begin())) {
addMessage(HintAnonymousFunctionSpacing, locationFromRange(locfunc, loclparen));
}
}
DeclarationsCheck bodyCheck;
addMessages(bodyCheck(ast));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment