Fix pipe expression start (#746)

This commit is contained in:
Adam Chalmers
2023-09-29 22:19:20 -04:00
committed by GitHub
parent 83907fa9db
commit 9797d0cb81
2 changed files with 7 additions and 3 deletions

View File

@ -403,7 +403,7 @@ describe('testing pipe operator special', () => {
id: { type: 'Identifier', start: 6, end: 14, name: 'mySketch' },
init: {
type: 'PipeExpression',
start: 15,
start: 17,
end: 145,
body: [
{
@ -644,7 +644,7 @@ describe('testing pipe operator special', () => {
},
init: {
type: 'PipeExpression',
start: 12,
start: 14,
end: 36,
body: [
{

View File

@ -1283,7 +1283,11 @@ impl Parser {
let end_token = self.get_token(pipe_body_result.last_index)?;
Ok(PipeExpressionResult {
expression: PipeExpression {
start: current_token.start,
start: pipe_body_result
.body
.first()
.map(|v| v.start())
.unwrap_or(current_token.start),
end: end_token.end,
body: pipe_body_result.body,
non_code_meta: pipe_body_result.non_code_meta,