Rename Expr::AddrOf to Reference
diff --git a/src/expr.rs b/src/expr.rs
index 2d85e50..eaa4ced 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -406,7 +406,7 @@
/// A referencing operation: `&a` or `&mut a`.
///
/// *This type is available if Syn is built with the `"full"` feature.*
- pub AddrOf(ExprAddrOf #full {
+ pub Reference(ExprReference #full {
pub attrs: Vec<Attribute>,
pub and_token: Token![&],
pub mutability: Option<Token![mut]>,
@@ -589,7 +589,7 @@
| Expr::Index(ExprIndex { ref mut attrs, .. })
| Expr::Range(ExprRange { ref mut attrs, .. })
| Expr::Path(ExprPath { ref mut attrs, .. })
- | Expr::AddrOf(ExprAddrOf { ref mut attrs, .. })
+ | Expr::Reference(ExprReference { ref mut attrs, .. })
| Expr::Break(ExprBreak { ref mut attrs, .. })
| Expr::Continue(ExprContinue { ref mut attrs, .. })
| Expr::Return(ExprReturn { ref mut attrs, .. })
@@ -1402,7 +1402,7 @@
and: punct!(&) >>
mutability: option!(keyword!(mut)) >>
expr: call!(unary_expr, allow_struct, true) >>
- (ExprAddrOf {
+ (ExprReference {
attrs: Vec::new(),
and_token: and,
mutability: mutability,
@@ -3219,7 +3219,7 @@
}
#[cfg(feature = "full")]
- impl ToTokens for ExprAddrOf {
+ impl ToTokens for ExprReference {
fn to_tokens(&self, tokens: &mut Tokens) {
tokens.append_all(self.attrs.outer());
self.and_token.to_tokens(tokens);
diff --git a/src/gen/fold.rs b/src/gen/fold.rs
index 46e94b2..3d0dde7 100644
--- a/src/gen/fold.rs
+++ b/src/gen/fold.rs
@@ -76,8 +76,6 @@
# [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr(&mut self, i: Expr) -> Expr { fold_expr(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-fn fold_expr_addr_of(&mut self, i: ExprAddrOf) -> ExprAddrOf { fold_expr_addr_of(self, i) }
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr_array(&mut self, i: ExprArray) -> ExprArray { fold_expr_array(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr_assign(&mut self, i: ExprAssign) -> ExprAssign { fold_expr_assign(self, i) }
@@ -132,6 +130,8 @@
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr_range(&mut self, i: ExprRange) -> ExprRange { fold_expr_range(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+fn fold_expr_reference(&mut self, i: ExprReference) -> ExprReference { fold_expr_reference(self, i) }
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr_repeat(&mut self, i: ExprRepeat) -> ExprRepeat { fold_expr_repeat(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn fold_expr_return(&mut self, i: ExprReturn) -> ExprReturn { fold_expr_return(self, i) }
@@ -915,9 +915,9 @@
_visitor.fold_expr_path(_binding_0),
)
}
- Expr::AddrOf(_binding_0, ) => {
- Expr::AddrOf (
- full!(_visitor.fold_expr_addr_of(_binding_0)),
+ Expr::Reference(_binding_0, ) => {
+ Expr::Reference (
+ full!(_visitor.fold_expr_reference(_binding_0)),
)
}
Expr::Break(_binding_0, ) => {
@@ -983,15 +983,6 @@
}
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-pub fn fold_expr_addr_of<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprAddrOf) -> ExprAddrOf {
- ExprAddrOf {
- attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
- and_token: Token ! [ & ](tokens_helper(_visitor, &(_i . and_token).0)),
- mutability: (_i . mutability).map(|it| { Token ! [ mut ](tokens_helper(_visitor, &(it).0)) }),
- expr: Box::new(_visitor.fold_expr(* _i . expr)),
- }
-}
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn fold_expr_array<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprArray) -> ExprArray {
ExprArray {
attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
@@ -1244,6 +1235,15 @@
}
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+pub fn fold_expr_reference<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprReference) -> ExprReference {
+ ExprReference {
+ attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
+ and_token: Token ! [ & ](tokens_helper(_visitor, &(_i . and_token).0)),
+ mutability: (_i . mutability).map(|it| { Token ! [ mut ](tokens_helper(_visitor, &(it).0)) }),
+ expr: Box::new(_visitor.fold_expr(* _i . expr)),
+ }
+}
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn fold_expr_repeat<V: Fold + ?Sized>(_visitor: &mut V, _i: ExprRepeat) -> ExprRepeat {
ExprRepeat {
attrs: FoldHelper::lift(_i . attrs, |it| { _visitor.fold_attribute(it) }),
diff --git a/src/gen/visit.rs b/src/gen/visit.rs
index 1add246..6205c54 100644
--- a/src/gen/visit.rs
+++ b/src/gen/visit.rs
@@ -74,8 +74,6 @@
# [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr(&mut self, i: &'ast Expr) { visit_expr(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-fn visit_expr_addr_of(&mut self, i: &'ast ExprAddrOf) { visit_expr_addr_of(self, i) }
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_array(&mut self, i: &'ast ExprArray) { visit_expr_array(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_assign(&mut self, i: &'ast ExprAssign) { visit_expr_assign(self, i) }
@@ -130,6 +128,8 @@
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_range(&mut self, i: &'ast ExprRange) { visit_expr_range(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+fn visit_expr_reference(&mut self, i: &'ast ExprReference) { visit_expr_reference(self, i) }
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_repeat(&mut self, i: &'ast ExprRepeat) { visit_expr_repeat(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_return(&mut self, i: &'ast ExprReturn) { visit_expr_return(self, i) }
@@ -733,8 +733,8 @@
Expr::Path(ref _binding_0, ) => {
_visitor.visit_expr_path(_binding_0);
}
- Expr::AddrOf(ref _binding_0, ) => {
- full!(_visitor.visit_expr_addr_of(_binding_0));
+ Expr::Reference(ref _binding_0, ) => {
+ full!(_visitor.visit_expr_reference(_binding_0));
}
Expr::Break(ref _binding_0, ) => {
full!(_visitor.visit_expr_break(_binding_0));
@@ -775,13 +775,6 @@
}
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-pub fn visit_expr_addr_of<'ast, V: Visit<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast ExprAddrOf) {
- for it in & _i . attrs { _visitor.visit_attribute(it) };
- tokens_helper(_visitor, &(& _i . and_token).0);
- if let Some(ref it) = _i . mutability { tokens_helper(_visitor, &(it).0) };
- _visitor.visit_expr(& * _i . expr);
-}
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn visit_expr_array<'ast, V: Visit<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast ExprArray) {
for it in & _i . attrs { _visitor.visit_attribute(it) };
tokens_helper(_visitor, &(& _i . bracket_token).0);
@@ -980,6 +973,13 @@
if let Some(ref it) = _i . to { _visitor.visit_expr(& * * it) };
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+pub fn visit_expr_reference<'ast, V: Visit<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast ExprReference) {
+ for it in & _i . attrs { _visitor.visit_attribute(it) };
+ tokens_helper(_visitor, &(& _i . and_token).0);
+ if let Some(ref it) = _i . mutability { tokens_helper(_visitor, &(it).0) };
+ _visitor.visit_expr(& * _i . expr);
+}
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn visit_expr_repeat<'ast, V: Visit<'ast> + ?Sized>(_visitor: &mut V, _i: &'ast ExprRepeat) {
for it in & _i . attrs { _visitor.visit_attribute(it) };
tokens_helper(_visitor, &(& _i . bracket_token).0);
diff --git a/src/gen/visit_mut.rs b/src/gen/visit_mut.rs
index 1bd9586..202f2d9 100644
--- a/src/gen/visit_mut.rs
+++ b/src/gen/visit_mut.rs
@@ -75,8 +75,6 @@
# [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_mut(&mut self, i: &mut Expr) { visit_expr_mut(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-fn visit_expr_addr_of_mut(&mut self, i: &mut ExprAddrOf) { visit_expr_addr_of_mut(self, i) }
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_array_mut(&mut self, i: &mut ExprArray) { visit_expr_array_mut(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_assign_mut(&mut self, i: &mut ExprAssign) { visit_expr_assign_mut(self, i) }
@@ -131,6 +129,8 @@
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_range_mut(&mut self, i: &mut ExprRange) { visit_expr_range_mut(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+fn visit_expr_reference_mut(&mut self, i: &mut ExprReference) { visit_expr_reference_mut(self, i) }
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_repeat_mut(&mut self, i: &mut ExprRepeat) { visit_expr_repeat_mut(self, i) }
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
fn visit_expr_return_mut(&mut self, i: &mut ExprReturn) { visit_expr_return_mut(self, i) }
@@ -734,8 +734,8 @@
Expr::Path(ref mut _binding_0, ) => {
_visitor.visit_expr_path_mut(_binding_0);
}
- Expr::AddrOf(ref mut _binding_0, ) => {
- full!(_visitor.visit_expr_addr_of_mut(_binding_0));
+ Expr::Reference(ref mut _binding_0, ) => {
+ full!(_visitor.visit_expr_reference_mut(_binding_0));
}
Expr::Break(ref mut _binding_0, ) => {
full!(_visitor.visit_expr_break_mut(_binding_0));
@@ -776,13 +776,6 @@
}
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
-pub fn visit_expr_addr_of_mut<V: VisitMut + ?Sized>(_visitor: &mut V, _i: &mut ExprAddrOf) {
- for it in & mut _i . attrs { _visitor.visit_attribute_mut(it) };
- tokens_helper(_visitor, &mut (& mut _i . and_token).0);
- if let Some(ref mut it) = _i . mutability { tokens_helper(_visitor, &mut (it).0) };
- _visitor.visit_expr_mut(& mut * _i . expr);
-}
-# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn visit_expr_array_mut<V: VisitMut + ?Sized>(_visitor: &mut V, _i: &mut ExprArray) {
for it in & mut _i . attrs { _visitor.visit_attribute_mut(it) };
tokens_helper(_visitor, &mut (& mut _i . bracket_token).0);
@@ -981,6 +974,13 @@
if let Some(ref mut it) = _i . to { _visitor.visit_expr_mut(& mut * * it) };
}
# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
+pub fn visit_expr_reference_mut<V: VisitMut + ?Sized>(_visitor: &mut V, _i: &mut ExprReference) {
+ for it in & mut _i . attrs { _visitor.visit_attribute_mut(it) };
+ tokens_helper(_visitor, &mut (& mut _i . and_token).0);
+ if let Some(ref mut it) = _i . mutability { tokens_helper(_visitor, &mut (it).0) };
+ _visitor.visit_expr_mut(& mut * _i . expr);
+}
+# [ cfg ( feature = "full" ) ] # [ cfg ( any ( feature = "full" , feature = "derive" ) ) ]
pub fn visit_expr_repeat_mut<V: VisitMut + ?Sized>(_visitor: &mut V, _i: &mut ExprRepeat) {
for it in & mut _i . attrs { _visitor.visit_attribute_mut(it) };
tokens_helper(_visitor, &mut (& mut _i . bracket_token).0);
diff --git a/src/lib.rs b/src/lib.rs
index 786c287..d881cd9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -293,7 +293,7 @@
#[cfg(any(feature = "full", feature = "derive"))]
mod expr;
#[cfg(any(feature = "full", feature = "derive"))]
-pub use expr::{Expr, ExprAddrOf, ExprArray, ExprAssign, ExprAssignOp, ExprBinary, ExprBlock,
+pub use expr::{Expr, ExprReference, ExprArray, ExprAssign, ExprAssignOp, ExprBinary, ExprBlock,
ExprBox, ExprBreak, ExprCall, ExprCast, ExprCatch, ExprClosure, ExprContinue,
ExprField, ExprForLoop, ExprGroup, ExprIf, ExprIfLet, ExprInPlace, ExprIndex,
ExprLit, ExprLoop, ExprMacro, ExprMatch, ExprMethodCall, ExprParen, ExprPath,