mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 06:11:16 +00:00
Rework the Rust entry point API for the interpreter
Switch to the stateful `ComponentCompiler` concept that we discussed for the C++ API.
This commit is contained in:
parent
6de1c4e3b5
commit
4a9cd954b8
9 changed files with 169 additions and 119 deletions
|
@ -62,14 +62,11 @@ fn load(mut cx: FunctionContext) -> JsResult<JsValue> {
|
|||
}
|
||||
None => vec![],
|
||||
};
|
||||
let compiler_config =
|
||||
sixtyfps_interpreter::CompilerConfiguration::new().with_include_paths(include_paths);
|
||||
let (c, diags) = spin_on::spin_on(sixtyfps_interpreter::ComponentDefinition::from_path(
|
||||
path,
|
||||
compiler_config,
|
||||
));
|
||||
let mut compiler = sixtyfps_interpreter::ComponentCompiler::new();
|
||||
compiler.set_include_paths(include_paths);
|
||||
let c = spin_on::spin_on(compiler.build_from_path(path));
|
||||
|
||||
sixtyfps_interpreter::print_diagnostics(&diags);
|
||||
sixtyfps_interpreter::print_diagnostics(&compiler.diagnostics());
|
||||
|
||||
let c = if let Some(c) = c { c } else { return cx.throw_error("Compilation error") };
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue