mirror of
https://github.com/janet-lang/janet
synced 2025-11-05 18:13:37 +00:00
Disallow NaN as table/struct key.
Fix bugs and add tests for denormalized tables and structs.
This commit is contained in:
@@ -131,6 +131,7 @@ Janet janet_table_remove(JanetTable *t, Janet key) {
|
||||
/* Put a value into the object */
|
||||
void janet_table_put(JanetTable *t, Janet key, Janet value) {
|
||||
if (janet_checktype(key, JANET_NIL)) return;
|
||||
if (janet_checktype(key, JANET_NUMBER) && isnan(janet_unwrap_number(key))) return;
|
||||
if (janet_checktype(value, JANET_NIL)) {
|
||||
janet_table_remove(t, key);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user