|
|
@ -577,7 +577,10 @@ fn run_initialization_script(cx: &mut Context) {
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: Report the error from requiring the file!
|
|
|
|
// TODO: Report the error from requiring the file!
|
|
|
|
ENGINE.with(|engine| {
|
|
|
|
ENGINE.with(|engine| {
|
|
|
|
let res = engine.borrow_mut().run(&format!(
|
|
|
|
|
|
|
|
|
|
|
|
let mut guard = engine.borrow_mut();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let res = guard.run(&format!(
|
|
|
|
r#"(require "{}")"#,
|
|
|
|
r#"(require "{}")"#,
|
|
|
|
helix_module_path.to_str().unwrap()
|
|
|
|
helix_module_path.to_str().unwrap()
|
|
|
|
));
|
|
|
|
));
|
|
|
@ -591,7 +594,7 @@ fn run_initialization_script(cx: &mut Context) {
|
|
|
|
let helix_path =
|
|
|
|
let helix_path =
|
|
|
|
"__module-mangler".to_string() + helix_module_path.as_os_str().to_str().unwrap();
|
|
|
|
"__module-mangler".to_string() + helix_module_path.as_os_str().to_str().unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
if let Ok(module) = engine.borrow_mut().extract_value(&helix_path) {
|
|
|
|
if let Ok(module) = guard.extract_value(&helix_path) {
|
|
|
|
if let steel::rvals::SteelVal::HashMapV(m) = module {
|
|
|
|
if let steel::rvals::SteelVal::HashMapV(m) = module {
|
|
|
|
let exported = m
|
|
|
|
let exported = m
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
@ -608,7 +611,7 @@ fn run_initialization_script(cx: &mut Context) {
|
|
|
|
let docs = exported
|
|
|
|
let docs = exported
|
|
|
|
.iter()
|
|
|
|
.iter()
|
|
|
|
.filter_map(|x| {
|
|
|
|
.filter_map(|x| {
|
|
|
|
if let Ok(value) = engine.borrow_mut().run(&format!(
|
|
|
|
if let Ok(value) = guard.run(&format!(
|
|
|
|
"(#%function-ptr-table-get #%function-ptr-table {})",
|
|
|
|
"(#%function-ptr-table-get #%function-ptr-table {})",
|
|
|
|
x
|
|
|
|
x
|
|
|
|
)) {
|
|
|
|
)) {
|
|
|
@ -642,8 +645,7 @@ fn run_initialization_script(cx: &mut Context) {
|
|
|
|
|
|
|
|
|
|
|
|
// These contents need to be registered with the path?
|
|
|
|
// These contents need to be registered with the path?
|
|
|
|
if let Ok(contents) = std::fs::read_to_string(&helix_module_path) {
|
|
|
|
if let Ok(contents) = std::fs::read_to_string(&helix_module_path) {
|
|
|
|
let res = engine
|
|
|
|
let res = guard
|
|
|
|
.borrow_mut()
|
|
|
|
|
|
|
|
.run_with_reference_from_path::<Context, Context>(
|
|
|
|
.run_with_reference_from_path::<Context, Context>(
|
|
|
|
cx,
|
|
|
|
cx,
|
|
|
|
"*helix.cx*",
|
|
|
|
"*helix.cx*",
|
|
|
|