Skip to content

Commit 6551285

Browse files
committed
Address review comments.
1 parent f3a3290 commit 6551285

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/libsyntax/parse/parser.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ macro_rules! maybe_whole_expr {
143143
$p.token.span, ExprKind::Block(block, None), ThinVec::new()
144144
));
145145
}
146+
// N.B: `NtIdent(ident)` is normalized to `Ident` in `fn bump`.
146147
_ => {},
147148
};
148149
}
@@ -2781,12 +2782,7 @@ impl<'a> Parser<'a> {
27812782
// can't continue an expression after an ident
27822783
token::Ident(name, is_raw) => token::ident_can_begin_expr(name, t.span, is_raw),
27832784
token::Literal(..) | token::Pound => true,
2784-
token::Interpolated(ref nt) => match **nt {
2785-
token::NtIdent(..) | token::NtExpr(..) |
2786-
token::NtBlock(..) | token::NtPath(..) => true,
2787-
_ => false,
2788-
},
2789-
_ => false
2785+
_ => t.is_whole_expr(),
27902786
};
27912787
let cannot_continue_expr = self.look_ahead(1, token_cannot_continue_expr);
27922788
if cannot_continue_expr {

src/libsyntax/parse/token.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,10 @@ impl Token {
478478

479479
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
480480
/// That is, is this a pre-parsed expression dropped into the token stream
481-
/// (which happens while parsing the result ofmacro expansion)?
481+
/// (which happens while parsing the result of macro expansion)?
482482
crate fn is_whole_expr(&self) -> bool {
483483
if let Interpolated(ref nt) = self.kind {
484-
if let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtBlock(_) = **nt {
484+
if let NtExpr(_) | NtLiteral(_) | NtPath(_) | NtIdent(..) | NtBlock(_) = **nt {
485485
return true;
486486
}
487487
}

0 commit comments

Comments
 (0)