mirror of
https://github.com/nushell/nushell.git
synced 2025-02-02 03:30:16 +01:00
Try to do less work during capture discovery (#5560)
This commit is contained in:
parent
a22d70718f
commit
5d40fc2726
@ -4924,7 +4924,9 @@ pub fn discover_captures_in_expr(
|
|||||||
output.extend(&result);
|
output.extend(&result);
|
||||||
}
|
}
|
||||||
Expr::Block(block_id) => {
|
Expr::Block(block_id) => {
|
||||||
|
if !seen_blocks.contains_key(block_id) {
|
||||||
let block = working_set.get_block(*block_id);
|
let block = working_set.get_block(*block_id);
|
||||||
|
seen_blocks.insert(*block_id, vec![]);
|
||||||
let results = {
|
let results = {
|
||||||
let mut seen = vec![];
|
let mut seen = vec![];
|
||||||
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
|
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
|
||||||
@ -4936,6 +4938,7 @@ pub fn discover_captures_in_expr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Expr::Binary(_) => {}
|
Expr::Binary(_) => {}
|
||||||
Expr::Bool(_) => {}
|
Expr::Bool(_) => {}
|
||||||
Expr::Call(call) => {
|
Expr::Call(call) => {
|
||||||
@ -5073,7 +5076,9 @@ pub fn discover_captures_in_expr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Expr::RowCondition(block_id) | Expr::Subexpression(block_id) => {
|
Expr::RowCondition(block_id) | Expr::Subexpression(block_id) => {
|
||||||
|
if !seen_blocks.contains_key(block_id) {
|
||||||
let block = working_set.get_block(*block_id);
|
let block = working_set.get_block(*block_id);
|
||||||
|
seen_blocks.insert(*block_id, vec![]);
|
||||||
let results = {
|
let results = {
|
||||||
let mut seen = vec![];
|
let mut seen = vec![];
|
||||||
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
|
discover_captures_in_block(working_set, block, &mut seen, seen_blocks)
|
||||||
@ -5085,6 +5090,7 @@ pub fn discover_captures_in_expr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Expr::Table(headers, values) => {
|
Expr::Table(headers, values) => {
|
||||||
for header in headers {
|
for header in headers {
|
||||||
let result = discover_captures_in_expr(working_set, header, seen, seen_blocks);
|
let result = discover_captures_in_expr(working_set, header, seen, seen_blocks);
|
||||||
|
Loading…
Reference in New Issue
Block a user