Throw a type error if defaultValue doesn't lead to a primitive type
authorLars Knoll <lars.knoll@digia.com>
Wed, 12 Dec 2012 18:06:19 +0000 (19:06 +0100)
committerSimon Hausmann <simon.hausmann@digia.com>
Wed, 12 Dec 2012 09:49:41 +0000 (10:49 +0100)
As specified in 8.12.8, we need to throw a type error if calling
[[defaultValue]] on an object doesn't convert to a primitive
type.

Change-Id: I6b5db91a36a21c6037998efb15646d00d49b5d4c
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
qmljs_runtime.cpp

index 4c200b2..55258fd 100644 (file)
@@ -509,6 +509,7 @@ Value __qmljs_object_default_value(ExecutionContext *ctx, Value object, int type
             return r;
     }
 
+    ctx->throwTypeError();
     return Value::undefinedValue();
 }