From f2be8915da84a5b6bac1305822878cdb9c2f1298 Mon Sep 17 00:00:00 2001 From: "Jesper K. Pedersen" Date: Fri, 17 May 2013 08:19:50 +0200 Subject: allow QFileInfo instance syntax I'm sure some JavaScript god will make my life misserable, but with this change I can write: var cppPath = QFileInfo(cppFile).absolutePath rather than var cppPath = (new QFileInfo(cppFile)).absolutePath Change-Id: I71c34d56796e3b29b0c4005b1b165d84732903f5 Reviewed-by: Nicolas Arnaud-Cormos --- wrappers/qfileinfoprototype.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/wrappers/qfileinfoprototype.cpp b/wrappers/qfileinfoprototype.cpp index ef1e54f..61716cd 100644 --- a/wrappers/qfileinfoprototype.cpp +++ b/wrappers/qfileinfoprototype.cpp @@ -37,16 +37,11 @@ namespace Internal { QScriptValue QFileInfoPrototype::construct(QScriptContext *context, QScriptEngine *engine) { - if ( context->isCalledAsConstructor() ) { - if ( context->argumentCount() != 1 ) { - context->throwError(tr("QFileInfo object must be constructed with a filename as parameter")); - return engine->undefinedValue(); - } - return engine->toScriptValue( QFileInfo(context->argument(0).toString())); - } - else { + if ( context->argumentCount() != 1 ) { + context->throwError(tr("QFileInfo object must be constructed with a filename as parameter")); return engine->undefinedValue(); } + return engine->toScriptValue( QFileInfo(context->argument(0).toString())); } #define FILE qscriptvalue_cast(thisObject()) -- cgit v1.2.3