fix: 变量声明完成值归空记录,脚本保留末非空完成值

This commit is contained in:
2026-09-14 20:15:08 +00:00
parent 53da6ef817
commit fa67988ab4
3 changed files with 8 additions and 8 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ fn eval(source: &str) -> String {
#[test]
fn eval_var_declaration() {
assert_eq!(eval("var x = 42"), "42");
// 变量声明语句完成值按规范为空记录(对外 undefined),不回填初始化器值。
assert_eq!(eval("var x = 42"), "undefined");
}
#[test]