diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-15 01:50:26 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-15 20:57:12 +0100 |
| commit | f8d2264463162291f5cb3391c98d7bc95ec17d87 (patch) | |
| tree | 513c6f3eae554053189a205993fe56db960b6462 /src/libsyntax | |
| parent | 1c2906ead3825c013ac022249f1e1ee3a3b97c75 (diff) | |
| download | rust-f8d2264463162291f5cb3391c98d7bc95ec17d87.tar.gz rust-f8d2264463162291f5cb3391c98d7bc95ec17d87.zip | |
parse associated statics.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/mut_visit.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 2 |
3 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index bbb629012a9..ca39fbd6c5d 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -2654,6 +2654,8 @@ pub enum AssocItemKind { /// A constant, `const $ident: $ty $def?;` where `def ::= "=" $expr? ;`. /// If `def` is parsed, then the constant is provided, and otherwise required. Const(P<Ty>, Option<P<Expr>>), + /// A static item (`static FOO: u8`). + Static(P<Ty>, Mutability, Option<P<Expr>>), /// A function. Fn(FnSig, Generics, Option<P<Block>>), /// A type. diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs index 62f640f0bfa..91db6158689 100644 --- a/src/libsyntax/mut_visit.rs +++ b/src/libsyntax/mut_visit.rs @@ -954,7 +954,7 @@ pub fn noop_flat_map_assoc_item<T: MutVisitor>( visitor.visit_vis(vis); visit_attrs(attrs, visitor); match kind { - AssocItemKind::Const(ty, expr) => { + AssocItemKind::Const(ty, expr) | AssocItemKind::Static(ty, _, expr) => { visitor.visit_ty(ty); visit_opt(expr, |expr| visitor.visit_expr(expr)); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 0dd21cdf12f..f5763ecf573 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -633,7 +633,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem, visitor.visit_ident(item.ident); walk_list!(visitor, visit_attribute, &item.attrs); match item.kind { - AssocItemKind::Const(ref ty, ref expr) => { + AssocItemKind::Const(ref ty, ref expr) | AssocItemKind::Static(ref ty, _, ref expr) => { visitor.visit_ty(ty); walk_list!(visitor, visit_expr, expr); } |
