mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 07:30:13 +01:00
Fix parser when def has missing params
This commit is contained in:
parent
db62bce6aa
commit
1f45304cf9
@ -1850,7 +1850,18 @@ pub fn parse_signature(
|
|||||||
|
|
||||||
if bytes.starts_with(b"[") {
|
if bytes.starts_with(b"[") {
|
||||||
start += 1;
|
start += 1;
|
||||||
|
} else {
|
||||||
|
error = error.or_else(|| {
|
||||||
|
Some(ParseError::Expected(
|
||||||
|
"[".into(),
|
||||||
|
Span {
|
||||||
|
start,
|
||||||
|
end: start + 1,
|
||||||
|
},
|
||||||
|
))
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if bytes.ends_with(b"]") {
|
if bytes.ends_with(b"]") {
|
||||||
end -= 1;
|
end -= 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -709,3 +709,8 @@ fn missing_column_error() -> TestResult {
|
|||||||
"cannot find column",
|
"cannot find column",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn missing_parameters() -> TestResult {
|
||||||
|
fail_test(r#"def foo {}"#, "expected [")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user