diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 6 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4value_def_p.h | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index a4533edc9c..995434aca2 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -275,7 +275,7 @@ Value FunctionPrototype::method_apply(SimpleCallContext *ctx) Object *arr = arg.asObject(); if (!arr) { - if (!(arg.isUndefined() || arg.isNull())) { + if (!arg.isNullOrUndefined()) { ctx->throwTypeError(); return Value::undefinedValue(); } @@ -404,7 +404,7 @@ Value ScriptFunction::call(Managed *that, const CallData &d) ExecutionContext *ctx = context->newCallContext(f, d); if (!f->strictMode && !d.thisObject.isObject()) { - if (d.thisObject.isUndefined() || d.thisObject.isNull()) { + if (d.thisObject.isNullOrUndefined()) { ctx->thisObject = Value::fromObject(f->engine()->globalObject); } else { ctx->thisObject = Value::fromObject(d.thisObject.toObject(context)); @@ -499,7 +499,7 @@ Value SimpleScriptFunction::call(Managed *that, const CallData &d) ExecutionContext *ctx = context->newCallContext(stackSpace, f, d); if (!f->strictMode && !d.thisObject.isObject()) { - if (d.thisObject.isUndefined() || d.thisObject.isNull()) { + if (d.thisObject.isNullOrUndefined()) { ctx->thisObject = Value::fromObject(f->engine()->globalObject); } else { ctx->thisObject = Value::fromObject(d.thisObject.toObject(context)); diff --git a/src/qml/jsruntime/qv4value_def_p.h b/src/qml/jsruntime/qv4value_def_p.h index a44af16b6a..7d037f3d49 100644 --- a/src/qml/jsruntime/qv4value_def_p.h +++ b/src/qml/jsruntime/qv4value_def_p.h @@ -80,6 +80,7 @@ struct Q_QML_EXPORT Value Type_Mask = 0xffff8000, Immediate_Mask = NotDouble_Mask | 0x00008000, IsManaged_Mask = Type_Mask & ~0x10000, + IsNullOrUndefined_Mask = Immediate_Mask | 0x20000, Tag_Shift = 32 }; enum ValueType { @@ -128,6 +129,7 @@ struct Q_QML_EXPORT Value inline bool isObject() const { return tag == Object_Type; } #endif inline bool isManaged() const { return (tag & IsManaged_Mask) == Object_Type; } + inline bool isNullOrUndefined() const { return (tag & IsNullOrUndefined_Mask) == Undefined_Type; } inline bool isConvertibleToInt() const { return (tag & ConvertibleToInt) == ConvertibleToInt; } inline bool isInt32() { if (tag == _Integer_Type) |