Prepare the compiler to be async

This will allow the online editor to load imports from URL asynchroniously later

Since currently the compiler is only working on a single thread, and that we
never await on a future that could block, it is allowed to use the spin_on executor
This commit is contained in:
Olivier Goffart 2020-10-30 11:18:27 +01:00
parent a7abfea961
commit 359f42c5f7
22 changed files with 110 additions and 89 deletions

View file

@ -331,9 +331,9 @@ pub fn sixtyfps(stream: TokenStream) -> TokenStream {
let syntax_node = parser::SyntaxNodeWithSourceFile { node: syntax_node, source_file };
//println!("{:#?}", syntax_node);
let compiler_config =
CompilerConfiguration { include_paths: &include_paths, ..Default::default() };
let (root_component, mut diag) = compile_syntax_node(syntax_node, diag, &compiler_config);
let compiler_config = CompilerConfiguration { include_paths, ..Default::default() };
let (root_component, mut diag) =
spin_on::spin_on(compile_syntax_node(syntax_node, diag, compiler_config));
//println!("{:#?}", tree);
if diag.has_error() {
diag.map_offsets_to_span(&tokens);