refactor: 将结构哈希与常量类从编译器拆分
This commit is contained in:
@@ -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>,
|
||||
|
||||
Reference in New Issue
Block a user