mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
prevent panic with let
alone in pipeline (#5676)
* prevent panic with `let` alone in pipeline * Update parser.rs
This commit is contained in:
parent
c42096c34e
commit
eb12fffbc6
1 changed files with 10 additions and 3 deletions
|
@ -4372,9 +4372,16 @@ pub fn parse_expression(
|
|||
)
|
||||
.0,
|
||||
Some(ParseError::LetInPipeline(
|
||||
String::from_utf8_lossy(working_set.get_span_contents(spans[spans.len() - 1]))
|
||||
.to_string(),
|
||||
String::from_utf8_lossy(working_set.get_span_contents(spans[1])).to_string(),
|
||||
String::from_utf8_lossy(match spans.len() {
|
||||
1 | 2 | 3 => b"value",
|
||||
_ => working_set.get_span_contents(spans[3]),
|
||||
})
|
||||
.to_string(),
|
||||
String::from_utf8_lossy(match spans.len() {
|
||||
1 => b"variable",
|
||||
_ => working_set.get_span_contents(spans[1]),
|
||||
})
|
||||
.to_string(),
|
||||
spans[0],
|
||||
)),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue