]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/build.rs
Unify structures and enum variants in AST
[rust.git] / src / libsyntax / ext / build.rs
index 5b35b870c305a879d6664ad9c84f868fda071a93..d448eb63204ebd7f278e880e450c49b7d6f5b8e2 100644 (file)
@@ -868,7 +868,7 @@ fn arm_unreachable(&self, span: Span) -> ast::Arm {
     }
 
     fn expr_match(&self, span: Span, arg: P<ast::Expr>, arms: Vec<ast::Arm>) -> P<Expr> {
-        self.expr(span, ast::ExprMatch(arg, arms, ast::MatchSource::Normal))
+        self.expr(span, ast::ExprMatch(arg, arms))
     }
 
     fn expr_if(&self, span: Span, cond: P<ast::Expr>,
@@ -993,15 +993,20 @@ fn item_fn(&self,
     }
 
     fn variant(&self, span: Span, name: Ident, tys: Vec<P<ast::Ty>> ) -> ast::Variant {
-        let args = tys.into_iter().map(|ty| {
-            ast::VariantArg { ty: ty, id: ast::DUMMY_NODE_ID }
+        let fields = tys.into_iter().map(|ty| {
+            Spanned { span: ty.span, node: ast::StructField_ {
+                ty: ty,
+                kind: ast::UnnamedField(ast::Inherited),
+                attrs: Vec::new(),
+                id: ast::DUMMY_NODE_ID,
+            }}
         }).collect();
 
         respan(span,
                ast::Variant_ {
                    name: name,
                    attrs: Vec::new(),
-                   kind: ast::TupleVariantKind(args),
+                   def: P(ast::StructDef { fields: fields, ctor_id: Some(ast::DUMMY_NODE_ID) }),
                    id: ast::DUMMY_NODE_ID,
                    disr_expr: None,
                })
@@ -1079,7 +1084,7 @@ fn item_ty(&self, span: Span, name: Ident, ty: P<ast::Ty>) -> P<ast::Item> {
     fn attribute(&self, sp: Span, mi: P<ast::MetaItem>) -> ast::Attribute {
         respan(sp, ast::Attribute_ {
             id: attr::mk_attr_id(),
-            style: ast::AttrOuter,
+            style: ast::AttrStyle::Outer,
             value: mi,
             is_sugared_doc: false,
         })