mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 12:25:58 +02:00
Evaluation of command arguments (#1801)
* WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * Finish adding the baseline refactors for argument invocation * Finish cleanup and add test * Add missing plugin references
This commit is contained in:
@ -567,6 +567,16 @@ impl SpannedExpression {
|
||||
}
|
||||
Expression::Variable(Variable::It(_)) => true,
|
||||
Expression::Path(path) => path.head.has_shallow_it_usage(),
|
||||
Expression::Invocation(block) => {
|
||||
for commands in block.block.iter() {
|
||||
for command in commands.list.iter() {
|
||||
if command.has_it_iteration() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
@ -614,6 +624,7 @@ impl PrettyDebugWithSource for SpannedExpression {
|
||||
Expression::Binary(binary) => binary.pretty_debug(source),
|
||||
Expression::Range(range) => range.pretty_debug(source),
|
||||
Expression::Block(_) => b::opaque("block"),
|
||||
Expression::Invocation(_) => b::opaque("invocation"),
|
||||
Expression::Garbage => b::opaque("garbage"),
|
||||
Expression::List(list) => b::delimit(
|
||||
"[",
|
||||
@ -654,6 +665,7 @@ impl PrettyDebugWithSource for SpannedExpression {
|
||||
Expression::Binary(binary) => binary.pretty_debug(source),
|
||||
Expression::Range(range) => range.pretty_debug(source),
|
||||
Expression::Block(_) => b::opaque("block"),
|
||||
Expression::Invocation(_) => b::opaque("invocation"),
|
||||
Expression::Garbage => b::opaque("garbage"),
|
||||
Expression::List(list) => b::delimit(
|
||||
"[",
|
||||
@ -874,6 +886,7 @@ pub enum Expression {
|
||||
FilePath(PathBuf),
|
||||
ExternalCommand(ExternalStringCommand),
|
||||
Command(Span),
|
||||
Invocation(hir::Block),
|
||||
|
||||
Boolean(bool),
|
||||
|
||||
@ -896,6 +909,7 @@ impl ShellTypeName for Expression {
|
||||
Expression::Binary(..) => "binary",
|
||||
Expression::Range(..) => "range",
|
||||
Expression::Block(..) => "block",
|
||||
Expression::Invocation(..) => "command invocation",
|
||||
Expression::Path(..) => "variable path",
|
||||
Expression::Boolean(..) => "boolean",
|
||||
Expression::ExternalCommand(..) => "external",
|
||||
|
Reference in New Issue
Block a user