+4
-6
src/execution/lazy.rs
+4
-6
src/execution/lazy.rs
···
65
let mut locals = VariableMap::new();
66
let mut store = LazyStore::new();
67
let mut scoped_store = LazyScopedVariables::new();
68
-
let mut lazy_graph = Vec::new();
69
let mut function_parameters = Vec::new();
70
let mut prev_element_debug_info = HashMap::new();
71
···
99
prev_element_debug_info: &mut prev_element_debug_info,
100
cancellation_flag,
101
};
102
-
for graph_stmt in &lazy_graph {
103
-
graph_stmt.evaluate(&mut exec)?;
104
-
}
105
// make sure any unforced values are now forced, to surface any problems
106
// hidden by the fact that the values were unused
107
store.evaluate_all(&mut exec)?;
···
140
mat: &'a QueryMatch<'a, 'tree>,
141
store: &'a mut LazyStore,
142
scoped_store: &'a mut LazyScopedVariables,
143
-
lazy_graph: &'a mut Vec<LazyStatement>,
144
function_parameters: &'a mut Vec<graph::Value>, // re-usable buffer to reduce memory allocations
145
prev_element_debug_info: &'a mut HashMap<GraphElementKey, DebugInfo>,
146
error_context: StatementContext,
···
179
locals: &mut VariableMap<'l, LazyValue>,
180
store: &mut LazyStore,
181
scoped_store: &mut LazyScopedVariables,
182
-
lazy_graph: &mut Vec<LazyStatement>,
183
function_parameters: &mut Vec<graph::Value>,
184
prev_element_debug_info: &mut HashMap<GraphElementKey, DebugInfo>,
185
inherited_variables: &HashSet<Identifier>,
···
65
let mut locals = VariableMap::new();
66
let mut store = LazyStore::new();
67
let mut scoped_store = LazyScopedVariables::new();
68
+
let mut lazy_graph = LazyGraph::new();
69
let mut function_parameters = Vec::new();
70
let mut prev_element_debug_info = HashMap::new();
71
···
99
prev_element_debug_info: &mut prev_element_debug_info,
100
cancellation_flag,
101
};
102
+
lazy_graph.evaluate(&mut exec)?;
103
// make sure any unforced values are now forced, to surface any problems
104
// hidden by the fact that the values were unused
105
store.evaluate_all(&mut exec)?;
···
138
mat: &'a QueryMatch<'a, 'tree>,
139
store: &'a mut LazyStore,
140
scoped_store: &'a mut LazyScopedVariables,
141
+
lazy_graph: &'a mut LazyGraph,
142
function_parameters: &'a mut Vec<graph::Value>, // re-usable buffer to reduce memory allocations
143
prev_element_debug_info: &'a mut HashMap<GraphElementKey, DebugInfo>,
144
error_context: StatementContext,
···
177
locals: &mut VariableMap<'l, LazyValue>,
178
store: &mut LazyStore,
179
scoped_store: &mut LazyScopedVariables,
180
+
lazy_graph: &mut LazyGraph,
181
function_parameters: &mut Vec<graph::Value>,
182
prev_element_debug_info: &mut HashMap<GraphElementKey, DebugInfo>,
183
inherited_variables: &HashSet<Identifier>,
+40
src/execution/lazy/statements.rs
+40
src/execution/lazy/statements.rs
···
22
use super::EvaluationContext;
23
use super::GraphElementKey;
24
25
+
/// Lazy graph
26
+
#[derive(Debug)]
27
+
pub(super) struct LazyGraph {
28
+
edge_statements: Vec<LazyStatement>,
29
+
attr_statements: Vec<LazyStatement>,
30
+
print_statements: Vec<LazyStatement>,
31
+
}
32
+
33
+
impl LazyGraph {
34
+
pub(super) fn new() -> Self {
35
+
LazyGraph {
36
+
edge_statements: Vec::new(),
37
+
attr_statements: Vec::new(),
38
+
print_statements: Vec::new(),
39
+
}
40
+
}
41
+
42
+
pub(super) fn push(&mut self, stmt: LazyStatement) {
43
+
match stmt {
44
+
LazyStatement::AddGraphNodeAttribute(_) => self.attr_statements.push(stmt),
45
+
LazyStatement::CreateEdge(_) => self.edge_statements.push(stmt),
46
+
LazyStatement::AddEdgeAttribute(_) => self.attr_statements.push(stmt),
47
+
LazyStatement::Print(_) => self.print_statements.push(stmt),
48
+
}
49
+
}
50
+
51
+
pub(super) fn evaluate(&self, exec: &mut EvaluationContext) -> Result<(), ExecutionError> {
52
+
for stmt in &self.edge_statements {
53
+
stmt.evaluate(exec)?;
54
+
}
55
+
for stmt in &self.attr_statements {
56
+
stmt.evaluate(exec)?;
57
+
}
58
+
for stmt in &self.print_statements {
59
+
stmt.evaluate(exec)?;
60
+
}
61
+
Ok(())
62
+
}
63
+
}
64
+
65
/// Lazy graph statements
66
#[derive(Debug)]
67
pub(super) enum LazyStatement {
+3
-3
tests/it/lazy_execution.rs
+3
-3
tests/it/lazy_execution.rs