From 791afa58ffcc78472c7ddddbe568a2293a0b6c24 Mon Sep 17 00:00:00 2001 From: f01dab1e Date: Tue, 22 Aug 2023 15:22:45 +0000 Subject: [PATCH] fix body expr span --- crates/noirc_frontend/src/parser/parser.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/noirc_frontend/src/parser/parser.rs b/crates/noirc_frontend/src/parser/parser.rs index 931ddfd35fc..f3b58617e45 100644 --- a/crates/noirc_frontend/src/parser/parser.rs +++ b/crates/noirc_frontend/src/parser/parser.rs @@ -168,12 +168,12 @@ fn function_definition(allow_self: bool) -> impl NoirParser { .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,