Skip to content

Commit e191085

Browse files
Parser: restore flatten comment in parse_compound_expr
1 parent 18c3fd0 commit e191085

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/parser/mod.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,9 +2052,14 @@ impl<'a> Parser<'a> {
20522052
})?;
20532053

20542054
match expr {
2055-
// `parse_prefix` does not itself follow compound chains, but a
2056-
// dialect override could still return a compound expression, so
2057-
// keep the flatten arms for safety.
2055+
// If we get back a compound field access or identifier,
2056+
// we flatten the nested expression.
2057+
// For example if the current root is `foo`
2058+
// and we get back a compound identifier expression `bar.baz`
2059+
// The full expression should be `foo.bar.baz` (i.e.
2060+
// a root with an access chain with 2 entries) and not
2061+
// `foo.(bar.baz)` (i.e. a root with an access chain with
2062+
// 1 entry`).
20582063
Some(Expr::CompoundFieldAccess { root, access_chain }) => {
20592064
chain.push(AccessExpr::Dot(*root));
20602065
chain.extend(access_chain);

0 commit comments

Comments
 (0)