Skip to content

Commit

Permalink
Add the span of attributes of the lhs to the span of the assignment e…
Browse files Browse the repository at this point in the history
…xpression
  • Loading branch information
topecongiro committed Feb 3, 2019
1 parent ec7ecb3 commit 9851a29
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3455,6 +3455,14 @@ impl<'a> Parser<'a> {
}),
}?;

// Make sure that the span of the parent node is larger than the span of lhs and rhs,
// including the attributes.
let lhs_span = lhs
.attrs
.iter()
.filter(|a| a.style == AttrStyle::Outer)
.next()
.map_or(lhs_span, |a| a.span);
let span = lhs_span.to(rhs.span);
lhs = match op {
AssocOp::Add | AssocOp::Subtract | AssocOp::Multiply | AssocOp::Divide |
Expand Down

0 comments on commit 9851a29

Please sign in to comment.