mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01: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
@ -4372,9 +4372,16 @@ pub fn parse_expression(
|
|||||||
)
|
)
|
||||||
.0,
|
.0,
|
||||||
Some(ParseError::LetInPipeline(
|
Some(ParseError::LetInPipeline(
|
||||||
String::from_utf8_lossy(working_set.get_span_contents(spans[spans.len() - 1]))
|
String::from_utf8_lossy(match spans.len() {
|
||||||
.to_string(),
|
1 | 2 | 3 => b"value",
|
||||||
String::from_utf8_lossy(working_set.get_span_contents(spans[1])).to_string(),
|
_ => 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],
|
spans[0],
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user