Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the spans of catch blocks to include the do #43463

Merged
merged 1 commit into from
Jul 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2243,9 +2243,9 @@ impl<'a> Parser<'a> {
attrs);
}
if self.is_catch_expr() {
let lo = self.span;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this come after self.eat_keyword(keywords::Do) instead of before?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed from using prev_span to span, so we can move it before the eat(Do) expression

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed the change. Thank you for your reply, and sorry for the noise.

assert!(self.eat_keyword(keywords::Do));
assert!(self.eat_keyword(keywords::Catch));
let lo = self.prev_span;
return self.parse_catch_expr(lo, attrs);
}
if self.eat_keyword(keywords::Return) {
Expand Down