Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix body expr span #2402

Merged
merged 1 commit into from Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/noirc_frontend/src/parser/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,12 @@ fn function_definition(allow_self: bool) -> impl NoirParser<NoirFunction> {
.then(parenthesized(function_parameters(allow_self)))
.then(function_return_type())
.then(where_clause())
.then(block(expression()))
.validate(|(((args, ret), where_clause), body), span, emit| {
.then(spanned(block(expression())))
.validate(|(((args, ret), where_clause), (body, body_span)), span, emit| {
let ((((attribute, modifiers), name), generics), parameters) = args;
validate_where_clause(&generics, &where_clause, span, emit);
FunctionDefinition {
span: name.0.span(),
span: body_span,
name,
attribute, // XXX: Currently we only have one attribute defined. If more attributes are needed per function, we can make this a vector and make attribute definition more expressive
is_unconstrained: modifiers.0,
Expand Down