mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-23 18:21:13 +08:00
feat: CLI 输出字符串两侧添加双引号以与数字区分
This commit is contained in:
@@ -92,7 +92,7 @@ fn eval(code: &str) -> ExitCode {
|
|||||||
fn format_result(vm: &Vm, val: JsValue) {
|
fn format_result(vm: &Vm, val: JsValue) {
|
||||||
if val.is_string() {
|
if val.is_string() {
|
||||||
if let Some(s) = vm.lookup_str(val) {
|
if let Some(s) = vm.lookup_str(val) {
|
||||||
println!("{s}");
|
println!("\"{s}\"");
|
||||||
} else {
|
} else {
|
||||||
println!("{val}");
|
println!("{val}");
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ fn format_result(vm: &Vm, val: JsValue) {
|
|||||||
fn print_value(vm: &Vm, val: JsValue) {
|
fn print_value(vm: &Vm, val: JsValue) {
|
||||||
if val.is_string() {
|
if val.is_string() {
|
||||||
if let Some(s) = vm.lookup_str(val) {
|
if let Some(s) = vm.lookup_str(val) {
|
||||||
print!("{s}");
|
print!("\"{s}\"");
|
||||||
} else {
|
} else {
|
||||||
print!("{val}");
|
print!("{val}");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user