From 2d56abfbebdc905dafc9cf9edc0a6f58e4de7cbd Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 16 Jan 2018 01:44:32 +0300 Subject: AST/HIR: Add a separate structure for labels --- src/libsyntax/ast.rs | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/ast.rs') diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index a64f1e9e400..926997f6567 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -33,6 +33,18 @@ use std::fmt; use std::rc::Rc; use std::u32; +#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] +pub struct Label { + pub ident: Ident, + pub span: Span, +} + +impl fmt::Debug for Label { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "label({:?})", self.ident) + } +} + #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)] pub struct Lifetime { pub id: NodeId, @@ -1078,23 +1090,23 @@ pub enum ExprKind { /// A while loop, with an optional label /// /// `'label: while expr { block }` - While(P, P, Option), + While(P, P, Option