mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
refactor: 动态编译改经 CompilerService 注入,oxide_vm 去编译器依赖
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::sync::Arc;
|
||||
|
||||
use oxide_compiler::compiler::Compiler;
|
||||
use oxide_compiler::DefaultCompilerService;
|
||||
use oxide_types::value::JsValue;
|
||||
use oxide_vm::vm::Vm;
|
||||
|
||||
@@ -249,6 +250,7 @@ fn function_apply_non_callable_this_throws_catchable_type_error() {
|
||||
// 不可调用 this(实例原型链含函数)经 apply 转发:抛可捕获 TypeError,
|
||||
// 不得绕过 try/catch 成为引擎级错误。
|
||||
let mut vm = Vm::new();
|
||||
vm.set_compiler_service(Arc::new(DefaultCompilerService));
|
||||
let name = eval(
|
||||
&mut vm,
|
||||
"function FACTORY(){} FACTORY.prototype = Function(); var o = new FACTORY(); try { o.apply(); } catch (e) { e.name }",
|
||||
|
||||
Reference in New Issue
Block a user