aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4managed.cpp
diff options
context:
space:
mode:
authorRobin Burchell <robin.burchell@crimson.no>2017-02-09 19:58:50 +0100
committerLars Knoll <lars.knoll@qt.io>2018-05-02 14:20:13 +0000
commita4207b2f958e12b01653d8285d9433a77bce9c52 (patch)
treebd56186a0a0112586379f92429c99be659d7e711 /src/qml/jsruntime/qv4managed.cpp
parentf665c9b25dde5d34f14a47f2aa52f8141bc03fd1 (diff)
Add Array Iterator objects from ES6 (22.1.5)
And implement / expose them via: 22.1.3.4 - Array.prototype.entries() 22.1.3.13 - Array.prototype.keys() 22.1.3.29 - Array.prototype.values() 22.1.3.31 - Array.prototype[Symbol.iterator] Most tests for Array iterators now pass. At the same time, expose them on TypedArray's prototype: - 22.2.3.15 %TypedArray%.prototype.keys - 22.2.3.29 %TypedArray%.prototype.values - 22.2.3.6 %TypedArray%.prototype.entries - 22.2.3.31 %TypedArray%.prototype[Symbol.iterator] For TypedArray, test coverage improves a tiny bit (3 passing tests), but the vast majority fail as it seems like the object structure for TypedArray is currently incomplete as far as ES6 expects. It seems that ES6 expects the object structure to be: * %TypedArray% (inherits FunctionObject) (this is the TypedArray intrinsic object, and responsible for initializing the TypedArray instances) * All the TypedArray ctors (e.g. UInt8Array) These inherit %TypedArray%, and make a super call to it to do their work * %TypedArrayPrototype% (inherits Object) (this is the initial prototype for %TypedArray%) * All the ctors have their own separate instance of this * The instances also make use it So, for instance, a lot of the tests attempt to access the prototype like: var proto = Object.getPrototypeOf(Int8Array) var keys = proto.prototype.keys As ES6 expects Int8Array.prototype to be %TypedArray% (22.2.5), this expands to: Object.getPrototypeOf(%TypedArray%) which it expects to be %TypedArrayPrototype%. But since we have no intrinsic object, and the ctors inherit FunctionObject, we instead return the wrong prototype into 'var proto'. Change-Id: I5e1a95a0420ecb70a0e35a5df3f65557510c5925 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4managed.cpp')
-rw-r--r--src/qml/jsruntime/qv4managed.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index a2e9deb854..d5ed0c0c32 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -122,6 +122,9 @@ QString Managed::className() const
case Type_ExecutionContext:
s = "__ExecutionContext";
break;
+ case Type_ArrayIteratorObject:
+ s = "Array Iterator";
+ break;
case Type_ForeachIteratorObject:
s = "__ForeachIterator";
break;