refactor: 将结构哈希与常量类从编译器拆分

This commit is contained in:
2026-06-06 09:44:48 +08:00
parent e83a621c9e
commit ac9967cf45
4 changed files with 102 additions and 100 deletions
+9 -1
View File
@@ -1,8 +1,16 @@
use std::fmt;
use crate::compiler::Constant;
use crate::opcode::{self, OpCode};
#[derive(Debug, Clone, PartialEq)]
pub enum Constant {
Number(f64),
String(String),
Boolean(bool),
Null,
Undefined,
}
pub struct CompiledModule {
pub bytecode: Vec<opcode::Instr>,
pub constants: Vec<Constant>,