Skip to content

Commit

Permalink
Fix Object.values/entries for numeric keys after 2v18 regression (fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Jun 5, 2023
1 parent c0bed8d commit 2b4caff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
2v19 :
2v19 : Fix Object.values/entries for numeric keys after 2v18 regression (fix #2375)

2v18 : Fix drawString with setClipRect with 90/270-degree rotation (fix #2343)
Pico/Wifi: Enabled JIT compiler
Expand Down
8 changes: 6 additions & 2 deletions src/jswrap_object.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,14 +333,18 @@ Return all enumerable keys and values of the given object
*/
void _jswrap_object_values_cb(void *data, JsVar *name) {
JsVar **cbData = (JsVar**)data;
jsvArrayPushAndUnLock(cbData[0], jspGetVarNamedField(cbData[1], name, false));
JsVar *field = jsvAsArrayIndex(name);
jsvArrayPushAndUnLock(cbData[0], jspGetVarNamedField(cbData[1], field, false));
jsvUnLock(field);
}
void _jswrap_object_entries_cb(void *data, JsVar *name) {
JsVar **cbData = (JsVar**)data;
JsVar *tuple = jsvNewEmptyArray();
if (!tuple) return;
jsvArrayPush(tuple, name);
jsvArrayPushAndUnLock(tuple, jspGetVarNamedField(cbData[1], name, false));
JsVar *field = jsvAsArrayIndex(name);
jsvArrayPushAndUnLock(tuple, jspGetVarNamedField(cbData[1], field, false));
jsvUnLock(field);
jsvArrayPushAndUnLock(cbData[0], tuple);
}
JsVar *jswrap_object_values_or_entries(JsVar *object, bool returnEntries) {
Expand Down

0 comments on commit 2b4caff

Please sign in to comment.