Skip to content

Commit

Permalink
Remove direct dependency on quirky_binder_lang
Browse files Browse the repository at this point in the history
  • Loading branch information
arnodb committed Feb 11, 2025
1 parent 7b52759 commit bb81c22
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 18 deletions.
14 changes: 10 additions & 4 deletions codegen/quirky_binder_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ fn quirky_binder_use_declaration(use_declaration: &UseDeclaration) -> TokenStrea

fn quirky_binder_graph_definition<'a>(
graph_definition: &'a GraphDefinition,
quirky_binder_crate: &Ident,
error_emitter: &mut QuirkyBinderErrorEmitter<'a>,
) -> TokenStream {
let name = format_ident!("{}", graph_definition.signature.name);
Expand Down Expand Up @@ -112,6 +113,7 @@ fn quirky_binder_graph_definition<'a>(
let (body, ordered_var_names, main_stream, mut named_streams) = quirky_binder_stream_lines(
graph_definition.signature.name,
&graph_definition.stream_lines,
quirky_binder_crate,
error_emitter,
);
let outputs = match graph_definition.signature.outputs.as_ref() {
Expand Down Expand Up @@ -194,6 +196,7 @@ fn quirky_binder_graph_definition<'a>(
fn quirky_binder_graph<'a>(
graph: &'a Graph<'a>,
graph_names: &mut GraphNames,
quirky_binder_crate: &Ident,
error_emitter: &mut QuirkyBinderErrorEmitter<'a>,
) -> TokenStream {
let Graph {
Expand All @@ -213,7 +216,7 @@ fn quirky_binder_graph<'a>(
};
let name = format_ident!("{}", name_str);
let (body, ordered_var_names, main_stream, named_streams) =
quirky_binder_stream_lines(&name_str, stream_lines, error_emitter);
quirky_binder_stream_lines(&name_str, stream_lines, quirky_binder_crate, error_emitter);
named_streams.check_all_streams_connected(error_emitter);
if let Some((_, anchor)) = main_stream {
error_emitter.emit_error(anchor, "main stream cannot be connected".into());
Expand Down Expand Up @@ -327,6 +330,7 @@ impl NamedStreamState<'_> {
fn quirky_binder_stream_lines<'a>(
caller: &str,
stream_lines: &'a [StreamLine<'a>],
quirky_binder_crate: &Ident,
error_emitter: &mut QuirkyBinderErrorEmitter<'a>,
) -> (
TokenStream,
Expand Down Expand Up @@ -469,7 +473,7 @@ fn quirky_binder_stream_lines<'a>(
let filter_location = {
let Location { line, col } =
error_emitter.part_to_location(filter.filter.name);
quote! { quirky_binder_lang::location::Location::new(#line, #col) }
quote! { #quirky_binder_crate::chain::Location::new(#line, #col) }
};
body.push(quote! {
let #var_name = {
Expand Down Expand Up @@ -562,9 +566,11 @@ pub(crate) fn generate_module<'a>(
quirky_binder_use_declaration(use_declaration)
}
ModuleItem::GraphDefinition(graph_definition) => {
quirky_binder_graph_definition(graph_definition, error_emitter)
quirky_binder_graph_definition(graph_definition, quirky_binder_crate, error_emitter)
}
ModuleItem::Graph(graph) => {
quirky_binder_graph(graph, &mut graph_names, quirky_binder_crate, error_emitter)
}
ModuleItem::Graph(graph) => quirky_binder_graph(graph, &mut graph_names, error_emitter),
}));
let exports = TokenStream::from_iter(
module
Expand Down
1 change: 0 additions & 1 deletion contrib/quirky_binder_csv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ readme = "README.md"
[dependencies]
getset = "0.1"
quirky_binder = { version = "0.1.1-dev", path = "../../quirky_binder" }
quirky_binder_lang = { version = "0.1.1-dev", path = "../../quirky_binder_lang" }
quote = "1"
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion examples/quirky_binder_example_index_first_char/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
getset = "0.1"
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
quote = "1"
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion examples/quirky_binder_example_tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
[build-dependencies]
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion examples/quirky_binder_example_wordlist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]

[build-dependencies]
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
quirky_binder_support = { path = "../../quirky_binder_support" }
handlebars = "4"
serde = { version = "1", features = ["derive"] }
Expand Down
7 changes: 2 additions & 5 deletions quirky_binder/src/chain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{borrow::Cow, collections::HashMap, fmt::Display};

use itertools::Itertools;
use proc_macro2::TokenStream;
use quirky_binder_lang::location::Location;
pub use quirky_binder_lang::location::Location;
use serde::Deserialize;
use syn::{Ident, Type};

Expand Down Expand Up @@ -945,10 +945,7 @@ macro_rules! trace_element {
TraceElement::new(
std::file!().into(),
($name).into(),
quirky_binder_lang::location::Location::new(
std::line!() as usize,
std::column!() as usize,
),
$crate::chain::Location::new(std::line!() as usize, std::column!() as usize),
)
.to_owned()
}
Expand Down
1 change: 0 additions & 1 deletion recipes/csv/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_csv = { path = "../../contrib/quirky_binder_csv" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion recipes/hello_world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
[build-dependencies]
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion recipes/postgres/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
[build-dependencies]
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion recipes/template/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ quirky_binder_monitor = ["chrono", "self-meter", "tracking-allocator"]
[build-dependencies]
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }
1 change: 0 additions & 1 deletion tests/quirky_binder_tests_source/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ anyhow = "1"
handlebars = "4"
quirky_binder = { path = "../../quirky_binder" }
quirky_binder_csv = { path = "../../contrib/quirky_binder_csv" }
quirky_binder_lang = { path = "../../quirky_binder_lang" }
serde = { version = "1", features = ["derive"] }
truc = { git = "https://github.com/arnodb/truc.git" }

0 comments on commit bb81c22

Please sign in to comment.