diff options
author | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-05-17 08:19:50 +0200 |
---|---|---|
committer | Jesper K. Pedersen <jesper.pedersen@kdab.com> | 2013-05-21 15:05:13 +0200 |
commit | f2be8915da84a5b6bac1305822878cdb9c2f1298 (patch) | |
tree | 382fa8a1c9a4c947bf8337a31b74eaff4223d009 | |
parent | afa9ae9c069c1f40004dd2849280e4c2efe6a8a8 (diff) |
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 <nicolas@kdab.com>
-rw-r--r-- | wrappers/qfileinfoprototype.cpp | 11 |
1 files 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<QFileInfo>(thisObject()) |