Fix the end location of an implicitly-concatenated string

This commit is contained in:
harupy 2022-12-10 17:49:57 +09:00
parent 009f2c4d38
commit dd01ab1c9e
6 changed files with 7 additions and 6 deletions

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 8,
column: 17,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 8,
column: 17,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 8,
column: 22,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 9,
column: 18,
},
),
custom: (),

View file

@ -24,7 +24,7 @@ expression: parse_ast
end_location: Some(
Location {
row: 1,
column: 9,
column: 22,
},
),
custom: (),

View file

@ -12,6 +12,7 @@ pub fn parse_strings(
// Preserve the initial location and kind.
let initial_start = values[0].0;
let initial_end = values[0].2;
let last_end = values.last().unwrap().2;
let initial_kind = (values[0].1 .1 == StringKind::U).then(|| "u".to_owned());
// Optimization: fast-track the common case of a single string.
@ -84,7 +85,7 @@ pub fn parse_strings(
Ok(if has_fstring {
Expr::new(
initial_start,
initial_end,
last_end,
ExprKind::JoinedStr { values: deduped },
)
} else {