Skip to content

Commit

Permalink
Merge pull request #473 from bm-w/bw/fix-default-file-path
Browse files Browse the repository at this point in the history
Fix not defaulting to `Builder::file` for `FILE_PATH`.
  • Loading branch information
hendrikvanantwerpen authored Dec 13, 2024
2 parents 123350f + 3090222 commit 69906f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tree-sitter-stack-graphs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,13 @@ impl<'a> Builder<'a> {
.add(JUMP_TO_SCOPE_NODE_VAR.into(), jump_to_scope_node.into())
.expect("Failed to set JUMP_TO_SCOPE_NODE");

if globals.get(&FILE_PATH_VAR.into()).is_none() {
let file_name = self.stack_graph[self.file].to_string();
globals
.add(FILE_PATH_VAR.into(), file_name.into())
.expect("Failed to set FILE_PATH");
}

let mut config = ExecutionConfig::new(&self.sgl.functions, &globals)
.lazy(true)
.debug_attributes(
Expand Down

0 comments on commit 69906f5

Please sign in to comment.