Commit 1b0dc765 authored by Christian Kamm's avatar Christian Kamm
Browse files

QmlJS checks: Add warning about 'eval'.

Migrated from QtChecker.

Change-Id: I4b3e8993c7b9f697497d2199b24bf49379dbc1b4
Reviewed-on: http://codereview.qt-project.org/5860


Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@nokia.com>
parent be9d25ec
......@@ -1160,6 +1160,8 @@ bool Check::visit(CallExpression *ast)
if (!name.isEmpty() && name.at(0).isUpper()) {
addMessage(WarnExpectedNewWithUppercaseFunction, location);
}
if (cast<IdentifierExpression *>(ast->base) && name == QLatin1String("eval"))
addMessage(WarnEval, location);
return true;
}
......
import QtQuick 1.0
Item {
function foo() {
eval("a + b") // 23 9 12
var a = { eval: function (string) { return string; } }
a.eval("a + b")
}
}
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