Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit f233315

Browse files
committed
增强命令行选项,添加自动命名空间查找功能,并更新示例用法以反映新选项。
1 parent 1d5d52d commit f233315

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,16 @@ fn main() {
207207
println!(" --cn-loop-stats 显示循环内存管理统计");
208208
println!(" --cn-loop-debug 启用循环内存调试输出");
209209
println!("");
210+
println!("🆕 命名空间选项:");
211+
println!(" --cn-auto-ns 启用自动命名空间查找(默认禁用)");
212+
println!("");
210213
println!("示例:");
211214
println!(" {} hello.cn", args[0]);
212215
println!(" {} hello.cn --cn-time", args[0]);
213216
println!(" {} hello.cn --cn-debug-jit", args[0]);
214217
println!(" {} hello.cn --cn-debug-lifetime --cn-time", args[0]);
215218
println!(" {} hello.cn --cn-memory-stats", args[0]);
219+
println!(" {} hello.cn --cn-auto-ns", args[0]);
216220
return;
217221
}
218222

@@ -233,6 +237,7 @@ fn main() {
233237
let memory_debug = args.iter().any(|arg| arg == "--cn-memory-debug");
234238
let show_loop_stats = args.iter().any(|arg| arg == "--cn-loop-stats");
235239
let loop_debug = args.iter().any(|arg| arg == "--cn-loop-debug");
240+
let auto_namespace = args.iter().any(|arg| arg == "--cn-auto-ns");
236241

237242
// v0.7.5新增:初始化内存池
238243
if memory_debug {
@@ -339,7 +344,7 @@ fn main() {
339344
}
340345

341346
// 执行程序
342-
let result = interpreter::interpret(&program);
347+
let result = interpreter::interpret(&program, auto_namespace);
343348

344349
// 只有当结果不是None且启用了--cn-return参数时才打印
345350
if show_return && !matches!(result, Value::None) {

0 commit comments

Comments
 (0)