diff options
| author | varkor <github@varkor.com> | 2019-09-26 14:39:48 +0100 |
|---|---|---|
| committer | varkor <github@varkor.com> | 2019-09-26 18:21:09 +0100 |
| commit | 95f6d72a60461a4a432d7e8971bb6a1899456b56 (patch) | |
| tree | df668b1056098eb4f00c2426136aecb3c51f1936 /src/libsyntax/parse | |
| parent | ddf43867a9cbb3766b48552632a602498fae2699 (diff) | |
| download | rust-95f6d72a60461a4a432d7e8971bb6a1899456b56.tar.gz rust-95f6d72a60461a4a432d7e8971bb6a1899456b56.zip | |
Rename `Expr.node` to `Expr.kind`
For both `ast::Expr` and `hir::Expr`.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/diagnostics.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/parse/literal.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser/expr.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/tests.rs | 2 |
5 files changed, 12 insertions, 12 deletions
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index 6ebfab3a133..44560688750 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -12,7 +12,7 @@ use crate::ast; /// |x| 5 /// isn't parsed as (if true {...} else {...} | x) | 5 pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool { - match e.node { + match e.kind { ast::ExprKind::If(..) | ast::ExprKind::Match(..) | ast::ExprKind::Block(..) | diff --git a/src/libsyntax/parse/diagnostics.rs b/src/libsyntax/parse/diagnostics.rs index 59de5f14123..c73ef982b07 100644 --- a/src/libsyntax/parse/diagnostics.rs +++ b/src/libsyntax/parse/diagnostics.rs @@ -161,7 +161,7 @@ impl RecoverQPath for Expr { fn recovered(qself: Option<QSelf>, path: ast::Path) -> Self { Self { span: path.span, - node: ExprKind::Path(qself, path), + kind: ExprKind::Path(qself, path), attrs: ThinVec::new(), id: ast::DUMMY_NODE_ID, } @@ -549,7 +549,7 @@ impl<'a> Parser<'a> { debug_assert!(outer_op.is_comparison(), "check_no_chained_comparison: {:?} is not comparison", outer_op); - match lhs.node { + match lhs.kind { ExprKind::Binary(op, _, _) if op.node.is_comparison() => { // Respan to include both operators. let op_span = op.span.to(self.token.span); @@ -915,7 +915,7 @@ impl<'a> Parser<'a> { .unwrap_or_else(|_| pprust::expr_to_string(&expr)); let suggestion = format!("{}.await{}", expr_str, if is_question { "?" } else { "" }); let sp = lo.to(hi); - let app = match expr.node { + let app = match expr.kind { ExprKind::Try(_) => Applicability::MaybeIncorrect, // `await <expr>?` _ => Applicability::MachineApplicable, }; diff --git a/src/libsyntax/parse/literal.rs b/src/libsyntax/parse/literal.rs index 36233de3cfb..973c54017b6 100644 --- a/src/libsyntax/parse/literal.rs +++ b/src/libsyntax/parse/literal.rs @@ -267,7 +267,7 @@ impl Lit { lit, token::Interpolated(ref nt) => { if let token::NtExpr(expr) | token::NtLiteral(expr) = &**nt { - if let ast::ExprKind::Lit(lit) = &expr.node { + if let ast::ExprKind::Lit(lit) = &expr.kind { return Ok(lit.clone()); } } diff --git a/src/libsyntax/parse/parser/expr.rs b/src/libsyntax/parse/parser/expr.rs index d0c865a7b8e..deb2140f797 100644 --- a/src/libsyntax/parse/parser/expr.rs +++ b/src/libsyntax/parse/parser/expr.rs @@ -210,7 +210,7 @@ impl<'a> Parser<'a> { // it refers to. Interpolated identifiers are unwrapped early and never show up here // as `PrevTokenKind::Interpolated` so if LHS is a single identifier we always process // it as "interpolated", it doesn't change the answer for non-interpolated idents. - let lhs_span = match (self.prev_token_kind, &lhs.node) { + let lhs_span = match (self.prev_token_kind, &lhs.kind) { (PrevTokenKind::Interpolated, _) => self.prev_span, (PrevTokenKind::Ident, &ExprKind::Path(None, ref path)) if path.segments.len() == 1 => self.prev_span, @@ -245,7 +245,7 @@ impl<'a> Parser<'a> { lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Cast)?; continue } else if op == AssocOp::Colon { - let maybe_path = self.could_ascription_be_path(&lhs.node); + let maybe_path = self.could_ascription_be_path(&lhs.kind); self.last_type_ascription = Some((self.prev_span, maybe_path)); lhs = self.parse_assoc_op_cast(lhs, lhs_span, ExprKind::Type)?; @@ -614,7 +614,7 @@ impl<'a> Parser<'a> { expr.map(|mut expr| { attrs.extend::<Vec<_>>(expr.attrs.into()); expr.attrs = attrs; - match expr.node { + match expr.kind { ExprKind::If(..) if !expr.attrs.is_empty() => { // Just point to the first attribute in there... let span = expr.attrs[0].span; @@ -1242,7 +1242,7 @@ impl<'a> Parser<'a> { fn parse_cond_expr(&mut self) -> PResult<'a, P<Expr>> { let cond = self.parse_expr_res(Restrictions::NO_STRUCT_LITERAL, None)?; - if let ExprKind::Let(..) = cond.node { + if let ExprKind::Let(..) = cond.kind { // Remove the last feature gating of a `let` expression since it's stable. let last = self.sess.gated_spans.let_chains.borrow_mut().pop(); debug_assert_eq!(cond.span, last.unwrap()); @@ -1779,7 +1779,7 @@ impl<'a> Parser<'a> { Ok(await_expr) } - crate fn mk_expr(&self, span: Span, node: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> { - P(Expr { node, span, attrs, id: DUMMY_NODE_ID }) + crate fn mk_expr(&self, span: Span, kind: ExprKind, attrs: ThinVec<Attribute>) -> P<Expr> { + P(Expr { kind, span, attrs, id: DUMMY_NODE_ID }) } } diff --git a/src/libsyntax/parse/tests.rs b/src/libsyntax/parse/tests.rs index 5cb59b3f827..984a2018e7a 100644 --- a/src/libsyntax/parse/tests.rs +++ b/src/libsyntax/parse/tests.rs @@ -272,7 +272,7 @@ fn ttdelim_span() { let expr = parse_expr_from_source_str(PathBuf::from("foo").into(), "foo!( fn main() { body } )".to_string(), &sess).unwrap(); - let tts: Vec<_> = match expr.node { + let tts: Vec<_> = match expr.kind { ast::ExprKind::Mac(ref mac) => mac.stream().trees().collect(), _ => panic!("not a macro"), }; |
