Revert "Try to do less work during capture discovery (#5560)" (#5561)

This reverts commit 5d40fc2726.
This commit is contained in:
JT 2022-05-17 10:49:59 +12:00 committed by GitHub
parent 5d40fc2726
commit e192684612
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4924,18 +4924,15 @@ pub fn discover_captures_in_expr(
output.extend(&result);
}
Expr::Block(block_id) => {
if !seen_blocks.contains_key(block_id) {
let block = working_set.get_block(*block_id);
seen_blocks.insert(*block_id, vec![]);
let results = {
let mut seen = vec![];
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
};
seen_blocks.insert(*block_id, results.clone());
for var_id in results.into_iter() {
if !seen.contains(&var_id) {
output.push(var_id)
}
let block = working_set.get_block(*block_id);
let results = {
let mut seen = vec![];
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
};
seen_blocks.insert(*block_id, results.clone());
for var_id in results.into_iter() {
if !seen.contains(&var_id) {
output.push(var_id)
}
}
}
@ -5076,18 +5073,15 @@ pub fn discover_captures_in_expr(
}
}
Expr::RowCondition(block_id) | Expr::Subexpression(block_id) => {
if !seen_blocks.contains_key(block_id) {
let block = working_set.get_block(*block_id);
seen_blocks.insert(*block_id, vec![]);
let results = {
let mut seen = vec![];
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
};
seen_blocks.insert(*block_id, results.clone());
for var_id in results.into_iter() {
if !seen.contains(&var_id) {
output.push(var_id)
}
let block = working_set.get_block(*block_id);
let results = {
let mut seen = vec![];
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
};
seen_blocks.insert(*block_id, results.clone());
for var_id in results.into_iter() {
if !seen.contains(&var_id) {
output.push(var_id)
}
}
}