-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting a struct slice by a compare method removes and duplicates items #403
Comments
This is a very tricky one... With the current implementation (after #378) accessing an array or a struct element of a wrapped Go reflect value returns a reference to that element, not a copy. So when you do this: a[0].name = '0';
a[1].name = '1';
let tmp = a[0];
a[0] = a[1];
Fixing this is non-trivial, because if Same thing applies to nested structs, and considering anonymous fields are also nested, the effects would be even more bizarre. It's easy to fix it so that it at least works for pointers (i.e. it would work for If anyone has any suggestions, let me know. |
Ok, I think this should sort it (and hopefully shouldn't break anything). Feedback is welcome as usual. |
dop251#403. (cherry picked from commit b1618db)
(cherry picked from commit 189bfeb)
* Fixed panic in newArrayFromIter when the iterator is already closed. Fixes dop251#375 * Fixed panic when parsing invalid object property keys. Fixes dop251#376. * Fixed accidental shadowing in the else branches of type assertion * Fixed defineProperty("length") for arrays. Improved detection of non-standard array configurations. Upgraded tc39 tests. * Return true values of struct fields or reflect slice elements, rather than pointers to them. Closes dop251#378. * Upgraded dependencies. Closes dop251#380. * Implemented exponentiation expressions. Closes dop251#381. * Enabled tests that use ** operator. Some array fixes as a result. * Implemented nullish coalescing operator (??). Closes dop251#382. * Implemented `{Array,String,%TypedArray%}.prototype.at` (dop251#384)e7c2872c8) * Fixed callee expressions in optional chains. Fixes dop251#385. * Do not use fmt.Sprintf() for plain error strings. Fixes dop251#388. * Implemented 'copy-on-change' mechanism for inner compound values. Fixes dop251#403. * Fixed objectGoReflect equality. See dop251#403 * Don't clear interrupt until the stack is empty (dop251#405) * test: skip Promise based tests
The return value of the sort + map somehow returns 3x the bin entry and omits the log/test thing.
The text was updated successfully, but these errors were encountered: