Skip to content

Commit

Permalink
Handle stuff in global namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
georgwiese committed Jun 28, 2024
1 parent 7d4e146 commit b428d5d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions backend/src/composite/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,13 @@ use powdr_number::FieldElement;
pub(crate) fn get_namespace(name: &str) -> String {
let mut namespace = AbsoluteSymbolPath::default().join(SymbolPath::from_str(name).unwrap());
namespace.pop().unwrap();
namespace.relative_to(&Default::default()).to_string()
let namespace = namespace.relative_to(&Default::default()).to_string();
if namespace.is_empty() {
// HACK
"std".to_string()
} else {
namespace
}
}

fn references_other_namespace<F: FieldElement>(
Expand Down Expand Up @@ -89,7 +95,7 @@ pub(crate) fn split_pil<F: FieldElement>(pil: Analyzed<F>) -> BTreeMap<String, A
let (std_namespaces, normal_namespaces): (BTreeMap<_, _>, BTreeMap<_, _>) =
statements_by_namespace
.into_iter()
.partition(|(k, _)| k.starts_with("std::"));
.partition(|(k, _)| k.starts_with("std"));
let statements_by_namespace = normal_namespaces
.into_iter()
.map(|(namespace, mut statements)| {
Expand Down

0 comments on commit b428d5d

Please sign in to comment.