Skip to content

Commit

Permalink
minor, symbol resolver is failing
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Dec 4, 2024
1 parent 5bfeaa2 commit eddd87e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions v0.5/fastn-compiler/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ impl Compiler {
let mut stuck_on_symbols = std::collections::HashSet::new();

let content = self.content.replace(vec![]).unwrap();
dbg!(&content);
let mut new_content = vec![];

for mut ci in content {
Expand Down Expand Up @@ -180,13 +179,10 @@ impl Compiler {
while iterations < ITERATION_THRESHOLD {
// resolve_document can internally run in parallel.
// TODO: pass unresolvable to self.resolve_document() and make sure they don't come back
dbg!(&self.content);
let unresolved_symbols = self.resolve_document();
if unresolved_symbols.is_empty() {
dbg!(&self.content);
break;
}
dbg!(&self.content);
// ever_used.extend(&unresolved_symbols);
self.fetch_unresolved_symbols(&unresolved_symbols).await;
// this itself has to happen in a loop. we need a warning if we are not able to resolve all
Expand Down Expand Up @@ -226,14 +222,14 @@ impl Compiler {
}

// there were no errors, etc.
Ok(dbg!(fastn_resolved::CompiledDocument {
Ok(fastn_resolved::CompiledDocument {
content: fastn_compiler::utils::resolved_content(self.content.unwrap()),
definitions: fastn_compiler::utils::used_definitions(
self.definitions,
self.definitions_used,
self.arena,
),
}))
})
}
}

Expand Down
1 change: 0 additions & 1 deletion v0.5/fastn-compiler/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
pub(crate) fn resolved_content(
content: Vec<fastn_unresolved::URCI>,
) -> Vec<fastn_resolved::ComponentInvocation> {
dbg!(&content);
// self.content should be all UR::R now
// every symbol in self.symbol_used in the bag must be UR::R now
content.into_iter().map(|ur| ur.into_resolved()).collect()
Expand Down
2 changes: 1 addition & 1 deletion v0.5/fastn-unresolved/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub struct Module {
package_len: std::num::NonZeroU16,
}

#[derive(Clone)]
#[derive(Clone, Debug)]
pub enum SoMBase<S, M> {
Symbol(S),
Module(M),
Expand Down
2 changes: 1 addition & 1 deletion v0.5/fastn/index.ftd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-- ftd#text: hello
-- ftd.text: hello world
;; -- ftd.text: hello world
3 changes: 2 additions & 1 deletion v0.5/fastn/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ impl fastn::commands::Serve {
}

async fn render(
_: hyper::Request<hyper::body::Incoming>,
r: hyper::Request<hyper::body::Incoming>,
global_aliases: fastn_unresolved::AliasesSimple,
) -> Result<hyper::Response<http_body_util::Full<hyper::body::Bytes>>, std::convert::Infallible> {
println!("{}: {}", r.method(), r.uri());
// let route = fastn_core::Route::Document("index.ftd".to_string(), serde_json::Value::Null);
Ok(hyper::Response::new(http_body_util::Full::new(
hyper::body::Bytes::from(
Expand Down

0 comments on commit eddd87e

Please sign in to comment.