aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4arrayiterator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement array methods for QQmlListPropertyUlf Hermann2022-07-161-1/+0
| | | | | | | | | | | | | | | | | | The test revealed that the fill() method of JS arrays did not properly range-check its parameters. Fix that, too. [ChangeLog][QtQml][Important Behavior Changes] QQmlListProperty behaves like a JavaScript Array now. You can use map(), reduce(), forEach() etc on it. This also includes a slight change of behavior to the push() method. push() now returns the new list length, and it checks the length to not exceed UINT_MAX. Task-number: QTBUG-58831 Fixes: QTBUG-49613 Fixes: QTBUG-99041 Change-Id: Ia64d73fb704449c280fbbc7ddcf20f4698c82e09 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
* Use SPDX license identifiersLucie GĂ©rard2022-06-111-39/+3
| | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Pick-to: 6.4 Task-number: QTBUG-67283 Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* V4 ArrayIterator: Protect retrieved value from GCUlf Hermann2022-03-241-3/+3
| | | | | | | | | | | When constructing the iterator return object, the garbage collector may run, and drop the element value we want to return. Fixes: QTBUG-101700 Pick-to: 5.15 6.2 6.3 Change-Id: I60c9b0b9fbb9e784fa089a8b5bb274d02ef7fc1f Reviewed-by: Maximilian Goldstein <max.goldstein@qt.io> Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
* Cleanups in Value/PrimitiveLars Knoll2018-09-171-4/+4
| | | | | | | | | | | | Get rid of Primitive and move the corresponding methods directly into Value. Mark many methods in Value as constexpr and turn Value into a POD type again. Keep Primitive as a pure alias to Value for source compatibility of other modules that might be using it. Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify the get and getIndexed vtable functions of QV4::ObjectLars Knoll2018-07-021-1/+1
| | | | | | | | This finalizes the refactoring of Object's vtable API. Also added the receiver argument to the method as required by the ES7 spec. Change-Id: I36f9989211c47458788fe9f7e929862bcfe7b845 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add the start of a Set from ES7Robin Burchell2018-05-301-1/+1
| | | | | | | | | | Based on top of an ArrayObject for now, which is admittedly a bit of a cheat and not matching the "spirit" of the spec. OTOH, that makes it easy to write, and is presumably quite lightweight, so perhaps this is acceptable as a starting point. Change-Id: Ibc98137965b3e75635b960a2f88c251d45e6e837 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Cleanup IteratorPrototype::createIterResult APILars Knoll2018-05-021-5/+5
| | | | | Change-Id: I42fe22c65f0551287f4acdc5a76889f07cca042c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add Array Iterator objects from ES6 (22.1.5)Robin Burchell2018-05-021-0/+106
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>