refactor: 重构 RetCommand 并添加日志记录

- 更新导入语句,明确导入模块
- 使用 LoggingUtils 替代 System.out.println 输出日志
- 添加换行符改善日志可读性
This commit is contained in:
Luke 2025-07-31 14:11:09 +08:00
parent 466b6ca2be
commit b7e9c8121e

View File

@ -1,7 +1,11 @@
package org.jcnc.snow.vm.commands.flow.control;
import org.jcnc.snow.vm.interfaces.Command;
import org.jcnc.snow.vm.module.*;
import org.jcnc.snow.vm.module.CallStack;
import org.jcnc.snow.vm.module.LocalVariableStore;
import org.jcnc.snow.vm.module.OperandStack;
import org.jcnc.snow.vm.module.StackFrame;
import org.jcnc.snow.vm.utils.LoggingUtils;
import static org.jcnc.snow.common.SnowConfig.print;
@ -37,7 +41,7 @@ public class RetCommand implements Command {
/* ----- Root frame: do NOT pop, just end program ----- */
if (topFrame.getReturnAddress() == PROGRAM_END) {
System.out.println("Return <root>");
LoggingUtils.logInfo("", "\nReturn <root>");
return PROGRAM_END; // VM main loop should break
}