Fix todo/error parsing
This was a bit more tricky than anticipated but played out nicely in the end. Now we have one holistic way of parsing todos and errors instead of it being duplicated between when/clause and sequence. The error/todo parser has been moved up to the expression part rather than being managed when parsing sequences. Not sure what motivated that to begin with. Fixes #621.
This commit is contained in:
@@ -27,7 +27,7 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
|
||||
|((((public, name), (arguments, args_span)), return_annotation), body), span| {
|
||||
ast::UntypedDefinition::Fn(ast::Function {
|
||||
arguments,
|
||||
body: body.unwrap_or_else(|| UntypedExpr::todo(span, None)),
|
||||
body: body.unwrap_or_else(|| UntypedExpr::todo(None, span)),
|
||||
doc: None,
|
||||
location: ast::Span {
|
||||
start: span.start,
|
||||
|
||||
@@ -23,7 +23,7 @@ pub fn parser() -> impl Parser<Token, ast::UntypedDefinition, Error = ParseError
|
||||
.map_with_span(|(((fail, name), span_end), body), span| {
|
||||
ast::UntypedDefinition::Test(ast::Function {
|
||||
arguments: vec![],
|
||||
body: body.unwrap_or_else(|| UntypedExpr::todo(span, None)),
|
||||
body: body.unwrap_or_else(|| UntypedExpr::todo(None, span)),
|
||||
doc: None,
|
||||
location: span_end,
|
||||
end_position: span.end - 1,
|
||||
|
||||
Reference in New Issue
Block a user