forked from qt-creator/qt-creator
QmlJS checks: Allow calling some builtin constructors as functions.
String, Boolean, Number and Object perform type conversion. Date returns the current date. Change-Id: I51e5bcbb0fa85ceb30b3ee3749f96c3e3b12ca21 Reviewed-on: http://codereview.qt-project.org/6043 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
@@ -1173,7 +1173,12 @@ bool Check::visit(CallExpression *ast)
|
||||
// check for capitalized function name being called
|
||||
SourceLocation location;
|
||||
const QString name = functionName(ast->base, &location);
|
||||
if (!name.isEmpty() && name.at(0).isUpper()) {
|
||||
if (!name.isEmpty() && name.at(0).isUpper()
|
||||
&& name != QLatin1String("String")
|
||||
&& name != QLatin1String("Boolean")
|
||||
&& name != QLatin1String("Date")
|
||||
&& name != QLatin1String("Number")
|
||||
&& name != QLatin1String("Object")) {
|
||||
addMessage(WarnExpectedNewWithUppercaseFunction, location);
|
||||
}
|
||||
if (cast<IdentifierExpression *>(ast->base) && name == QLatin1String("eval"))
|
||||
|
Reference in New Issue
Block a user