Skip to content

Commit 3313888

Browse files
Swap conditions because is_root ==> is_in_file
1 parent 78fbbfd commit 3313888

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

stack-graphs/src/storage.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,16 @@ impl SQLiteWriter {
362362
path.display(graph, partials)
363363
);
364364
let start_node = graph[path.start_node].id();
365-
if start_node.is_in_file(file) {
365+
if start_node.is_root() {
366+
copious_debugging!(
367+
" * Add as root path with symbol stack {}",
368+
path.symbol_stack_precondition.display(graph, partials),
369+
);
370+
let symbol_stack = path.symbol_stack_precondition.storage_key(graph, partials);
371+
let path = serde::PartialPath::from_partial_path(graph, partials, path);
372+
root_stmt.execute((file_str, symbol_stack, &serde_json::to_vec(&path)?))?;
373+
root_path_count += 1;
374+
} else if start_node.is_in_file(file) {
366375
copious_debugging!(
367376
" * Add as node path from node {}",
368377
path.start_node.display(graph),
@@ -374,15 +383,6 @@ impl SQLiteWriter {
374383
&serde_json::to_vec(&path)?,
375384
))?;
376385
node_path_count += 1;
377-
} else if start_node.is_root() {
378-
copious_debugging!(
379-
" * Add as root path with symbol stack {}",
380-
path.symbol_stack_precondition.display(graph, partials),
381-
);
382-
let symbol_stack = path.symbol_stack_precondition.storage_key(graph, partials);
383-
let path = serde::PartialPath::from_partial_path(graph, partials, path);
384-
root_stmt.execute((file_str, symbol_stack, &serde_json::to_vec(&path)?))?;
385-
root_path_count += 1;
386386
} else {
387387
panic!(
388388
"added path {} must start in given file {} or at root",

0 commit comments

Comments
 (0)