-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finally fastn-core depends on v0.5/fastn-compiler
- Loading branch information
Showing
7 changed files
with
161 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
impl fastn_ds::DocumentStore { | ||
// fn find_all_definitions_in_a_module( | ||
// &mut self, | ||
// arena: &mut fastn_unresolved::Arena, | ||
// global_aliases: &fastn_unresolved::AliasesSimple, | ||
// (file, module): (String, fastn_unresolved::Module), | ||
// ) -> Vec<fastn_unresolved::URD> { | ||
// // we need to fetch the symbol from the store | ||
// let source = match std::fs::File::open(file.as_str()).and_then(std::io::read_to_string) { | ||
// Ok(v) => v, | ||
// Err(e) => { | ||
// println!("failed to read file {}.ftd: {e:?}", file); | ||
// return vec![]; | ||
// } | ||
// }; | ||
// | ||
// let d = fastn_unresolved::parse(module.clone(), &source, arena, global_aliases); | ||
// | ||
// d.definitions | ||
// .into_iter() | ||
// .map(|d| match d { | ||
// fastn_unresolved::UR::UnResolved(mut v) => { | ||
// v.symbol = Some(module.symbol(v.name.unresolved().unwrap().str(), arena)); | ||
// fastn_unresolved::UR::UnResolved(v) | ||
// } | ||
// _ => { | ||
// unreachable!("fastn_unresolved::parse() only returns unresolved definitions") | ||
// } | ||
// }) | ||
// .collect::<Vec<_>>() | ||
// } | ||
} | ||
|
||
#[async_trait::async_trait] | ||
impl fastn_compiler::SymbolStore for fastn_ds::DocumentStore { | ||
async fn lookup( | ||
&mut self, | ||
_arena: &mut fastn_unresolved::Arena, | ||
_global_aliases: &fastn_unresolved::AliasesSimple, | ||
_symbols: &std::collections::HashSet<fastn_unresolved::Symbol>, | ||
) -> Vec<fastn_unresolved::URD> { | ||
todo!() | ||
// let unique_modules = symbols | ||
// .iter() | ||
// .map(|s| file_for_symbol(s, arena)) | ||
// .collect::<std::collections::HashSet<_>>(); | ||
// | ||
// unique_modules | ||
// .into_iter() | ||
// .flat_map(|m| self.find_all_definitions_in_a_module(arena, global_aliases, m)) | ||
// .collect() | ||
} | ||
} | ||
|
||
// fn file_for_symbol( | ||
// symbol: &fastn_unresolved::Symbol, | ||
// arena: &mut fastn_unresolved::Arena, | ||
// ) -> (String, fastn_unresolved::Module) { | ||
// ( | ||
// // this code is nonsense right now | ||
// match symbol.module(arena) { | ||
// Some(module) => format!("{}/{}.ftd", symbol.package(arena), module), | ||
// None => format!("{}/index.ftd", symbol.package(arena)), | ||
// }, | ||
// symbol.parent(arena), | ||
// ) | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters