diff options
author | Lars Knoll <[email protected]> | 2013-11-13 11:45:51 +0100 |
---|---|---|
committer | The Qt Project <[email protected]> | 2013-11-22 14:54:05 +0100 |
commit | 9bf5e87ef0abd3c4612baca66c79e2d33f8fbfb9 (patch) | |
tree | 17d22dec37edea8e2d01fc686285055e712113c8 /src/qml/jsruntime/qv4runtime.cpp | |
parent | 1a76a4926a7cfecbe2bf4d75589af54e98c201c5 (diff) |
Use lookups for create_property (ie. new foo.bar)
This is not used that often, but it removes one more place
where we do lookups by name.
Change-Id: I9f798b8b4a64be3fdf3e53090e4288724c9d2b22
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4runtime.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index a8cabcb374..4c0573ceaf 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -966,10 +966,10 @@ ReturnedValue __qmljs_construct_value(ExecutionContext *context, const ValueRef return f->construct(callData); } -ReturnedValue __qmljs_construct_property(ExecutionContext *context, const ValueRef base, const StringRef name, CallDataRef callData) +ReturnedValue __qmljs_construct_property(ExecutionContext *context, const StringRef name, CallDataRef callData) { Scope scope(context); - ScopedObject thisObject(scope, base->toObject(context)); + ScopedObject thisObject(scope, callData->thisObject.toObject(context)); if (scope.engine->hasException) return Encode::undefined(); @@ -980,6 +980,18 @@ ReturnedValue __qmljs_construct_property(ExecutionContext *context, const ValueR return f->construct(callData); } +ReturnedValue __qmljs_construct_property_lookup(ExecutionContext *context, uint index, CallDataRef callData) +{ + Lookup *l = context->lookups + index; + SafeValue v; + v = l->getter(l, callData->thisObject); + if (!v.isManaged()) + return context->throwTypeError(); + + return v.managed()->construct(callData); +} + + void __qmljs_throw(ExecutionContext *context, const ValueRef value) { if (!value->isEmpty()) |