refactor: 字符串值改用 JsString 指针表示,键与字面量改用 PermInterner
This commit is contained in:
@@ -14,10 +14,7 @@ fn eval(vm: &mut Vm, source: &str) -> Result<JsValue, String> {
|
||||
}
|
||||
|
||||
fn str_val(vm: &Vm, val: JsValue) -> String {
|
||||
vm.kernel_core()
|
||||
.string_forge()
|
||||
.lookup(val.as_string_index())
|
||||
.unwrap_or_default()
|
||||
vm.lookup_str(val).unwrap_or_default()
|
||||
}
|
||||
|
||||
// -- direct native fn tests --
|
||||
@@ -47,7 +44,7 @@ fn tboolean_call_true_false() {
|
||||
#[test]
|
||||
fn tboolean_call_empty_string() {
|
||||
let mut vm = Vm::new();
|
||||
let empty = vm.intern("");
|
||||
let empty = vm.new_string("");
|
||||
assert!(!bool_ctor_call(&mut vm, empty).as_bool());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user