Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions crates/perry-runtime/src/object/field_get_set/has_property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,15 @@ pub extern "C" fn js_object_has_property(obj: f64, key: f64) -> f64 {
) {
return nanbox_true;
}
// A canonical numeric-index string (`"0"`, `"2"`, …) is an own
// in-bounds index. The round-trip check rejects non-canonical
// forms (`"00"`, `"1.5"`, `"-1"`, `"0x1"`), which are ordinary
// (absent) string keys.
if let Ok(idx) = name.parse::<u32>() {
if idx.to_string() == name && idx < len as u32 {
return nanbox_true;
}
}
}
return nanbox_false;
}
Expand Down
Loading