feat: 支持箭头函数/模板字符串/let/const/delete/instanceof 语法

This commit is contained in:
爱特每羊队
2026-06-08 19:55:05 +08:00
parent a6e448e326
commit 209374fc02
15 changed files with 1379 additions and 91 deletions
@@ -0,0 +1,19 @@
use oxide_compiler::compiler::Compiler;
#[test]
fn hash_var_let_const_differ() {
let compiler = Compiler::new();
let allocator = oxide_parser::Allocator::default();
let var_ast = oxide_parser::parse(&allocator, "var x = 1").unwrap();
let let_ast = oxide_parser::parse(&allocator, "let x = 1").unwrap();
let const_ast = oxide_parser::parse(&allocator, "const x = 1").unwrap();
// Different AST structures should produce different bytecode
let var_module = compiler.compile(&var_ast).unwrap();
let let_module = compiler.compile(&let_ast).unwrap();
let const_module = compiler.compile(&const_ast).unwrap();
assert_eq!(var_module.n_registers, let_module.n_registers);
assert_eq!(let_module.n_registers, const_module.n_registers);
}