fix: 大数组索引写降级命名属性并扩展逻辑长度

This commit is contained in:
2026-09-29 13:05:37 +00:00
parent 0c4fed0373
commit f70de8cb43
6 changed files with 366 additions and 45 deletions
+3 -2
View File
@@ -223,8 +223,9 @@ fn test_new_spread_deep_recursion_throws_catchable_range_error() {
#[test]
fn test_array_length_range_error() {
let result = eval("new Array(4294967295)");
assert!(result.contains("Invalid array length"), "expected invalid length, got: {result}");
// 2^32-1 是合法数组长度:逻辑长度记覆盖位,物理区按稠密上限钳位。
let result = eval("new Array(4294967295).length");
assert_eq!(result, "4294967295", "2^32-1 合法长度,got: {result}");
let result = eval("new Array(-1)");
assert!(result.contains("Invalid array length"), "expected invalid length, got: {result}");
}