summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorErick Tryzelaar <erick.tryzelaar@gmail.com>2013-02-25 06:19:44 -0800
committerErick Tryzelaar <erick.tryzelaar@gmail.com>2013-02-25 06:19:44 -0800
commit5b9e110eab9c30428e99995a0adbec82857e3a1a (patch)
treeeee469f01c305aa346c070a430336852d5900753 /src/libsyntax
parentb26d434ad126c1ee35ca63c02ff3d9a243e3a00a (diff)
downloadrust-5b9e110eab9c30428e99995a0adbec82857e3a1a.tar.gz
rust-5b9e110eab9c30428e99995a0adbec82857e3a1a.zip
libsyntax: Convert ast::attribute_ to store a @meta_item
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs2
-rw-r--r--src/libsyntax/attr.rs15
-rw-r--r--src/libsyntax/ext/auto_encode.rs4
-rw-r--r--src/libsyntax/ext/base.rs2
-rw-r--r--src/libsyntax/ext/deriving.rs4
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs2
-rw-r--r--src/libsyntax/fold.rs2
-rw-r--r--src/libsyntax/parse/attr.rs2
-rw-r--r--src/libsyntax/print/pprust.rs2
9 files changed, 18 insertions, 17 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 6befb2f1880..4d071e4b26f 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1142,7 +1142,7 @@ pub enum attr_style { attr_outer, attr_inner, }
 #[deriving_eq]
 pub struct attribute_ {
     style: attr_style,
-    value: meta_item,
+    value: @meta_item,
     is_sugared_doc: bool,
 }
 
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 14ffb1cab5d..3967ea3437b 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -51,16 +51,17 @@ pub fn mk_word_item(name: @~str) -> @ast::meta_item {
 
 pub fn mk_attr(item: @ast::meta_item) -> ast::attribute {
     dummy_spanned(ast::attribute_ { style: ast::attr_inner,
-                                    value: *item,
+                                    value: item,
                                     is_sugared_doc: false })
 }
 
-pub fn mk_sugared_doc_attr(text: ~str,
+pub fn mk_sugared_doc_attr(+text: ~str,
                            +lo: BytePos, +hi: BytePos) -> ast::attribute {
+    let style = doc_comment_style(text);
     let lit = spanned(lo, hi, ast::lit_str(@text));
     let attr = ast::attribute_ {
-        style: doc_comment_style(text),
-        value: spanned(lo, hi, ast::meta_name_value(@~"doc", lit)),
+        style: style,
+        value: @spanned(lo, hi, ast::meta_name_value(@~"doc", lit)),
         is_sugared_doc: true
     };
     spanned(lo, hi, attr)
@@ -69,7 +70,7 @@ pub fn mk_sugared_doc_attr(text: ~str,
 /* Conversion */
 
 pub fn attr_meta(attr: ast::attribute) -> @ast::meta_item {
-    @attr.node.value
+    attr.node.value
 }
 
 // Get the meta_items from inside a vector of attributes
@@ -79,7 +80,7 @@ pub fn attr_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] {
 
 pub fn desugar_doc_attr(attr: &ast::attribute) -> ast::attribute {
     if attr.node.is_sugared_doc {
-        let comment = get_meta_item_value_str(@attr.node.value).get();
+        let comment = get_meta_item_value_str(attr.node.value).get();
         let meta = mk_name_value_item_str(@~"doc",
                                      @strip_doc_comment_decoration(*comment));
         mk_attr(meta)
@@ -91,7 +92,7 @@ pub fn desugar_doc_attr(attr: &ast::attribute) -> ast::attribute {
 /* Accessors */
 
 pub pure fn get_attr_name(attr: &ast::attribute) -> @~str {
-    get_meta_item_name(@attr.node.value)
+    get_meta_item_name(attr.node.value)
 }
 
 pub pure fn get_meta_item_name(meta: @ast::meta_item) -> @~str {
diff --git a/src/libsyntax/ext/auto_encode.rs b/src/libsyntax/ext/auto_encode.rs
index 7fbba987cc7..c2d1d82833d 100644
--- a/src/libsyntax/ext/auto_encode.rs
+++ b/src/libsyntax/ext/auto_encode.rs
@@ -110,7 +110,7 @@ mod syntax {
 pub fn expand_auto_encode(
     cx: ext_ctxt,
     span: span,
-    _mitem: ast::meta_item,
+    _mitem: @ast::meta_item,
     in_items: ~[@ast::item]
 ) -> ~[@ast::item] {
     fn is_auto_encode(a: &ast::attribute) -> bool {
@@ -165,7 +165,7 @@ pub fn expand_auto_encode(
 pub fn expand_auto_decode(
     cx: ext_ctxt,
     span: span,
-    _mitem: ast::meta_item,
+    _mitem: @ast::meta_item,
     in_items: ~[@ast::item]
 ) -> ~[@ast::item] {
     fn is_auto_decode(a: &ast::attribute) -> bool {
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index f3a74302400..2f35e9ed978 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -38,7 +38,7 @@ pub struct MacroDef {
 }
 
 pub type ItemDecorator =
-    fn@(ext_ctxt, span, ast::meta_item, ~[@ast::item]) -> ~[@ast::item];
+    fn@(ext_ctxt, span, @ast::meta_item, ~[@ast::item]) -> ~[@ast::item];
 
 pub struct SyntaxExpanderTT {
     expander: SyntaxExpanderTTFun,
diff --git a/src/libsyntax/ext/deriving.rs b/src/libsyntax/ext/deriving.rs
index 094eea81fd2..4942558f8bc 100644
--- a/src/libsyntax/ext/deriving.rs
+++ b/src/libsyntax/ext/deriving.rs
@@ -58,7 +58,7 @@ type ExpandDerivingEnumDefFn = &fn(ext_ctxt,
 
 pub fn expand_deriving_eq(cx: ext_ctxt,
                           span: span,
-                          _mitem: meta_item,
+                          _mitem: @meta_item,
                           in_items: ~[@item])
                        -> ~[@item] {
     expand_deriving(cx,
@@ -70,7 +70,7 @@ pub fn expand_deriving_eq(cx: ext_ctxt,
 
 pub fn expand_deriving_iter_bytes(cx: ext_ctxt,
                                   span: span,
-                                  _mitem: meta_item,
+                                  _mitem: @meta_item,
                                   in_items: ~[@item])
                                -> ~[@item] {
     expand_deriving(cx,
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 49f7fe5853e..cc843594709 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -227,7 +227,7 @@ pub impl ext_ctxt_ast_builder for ext_ctxt {
         // Rust coding conventions
         let non_camel_case_attribute = respan(dummy_sp(), ast::attribute_ {
             style: ast::attr_outer,
-            value: respan(dummy_sp(),
+            value: @respan(dummy_sp(),
                           ast::meta_list(@~"allow", ~[
                               @respan(dummy_sp(),
                                       ast::meta_word(
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index dacb6f60e37..eaf29d40c3b 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -98,7 +98,7 @@ fn fold_attribute_(at: attribute, fld: ast_fold) -> attribute {
     spanned {
         node: ast::attribute_ {
             style: at.node.style,
-            value: *fold_meta_item_(@at.node.value, fld),
+            value: fold_meta_item_(at.node.value, fld),
             is_sugared_doc: at.node.is_sugared_doc,
         },
         span: fld.new_span(at.span),
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index c0c97a0b9eb..87ecf6a9567 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -72,7 +72,7 @@ impl parser_attr for Parser {
         self.expect(token::RBRACKET);
         let mut hi = self.span.hi;
         return spanned(lo, hi, ast::attribute_ { style: style,
-                                                 value: *meta_item,
+                                                 value: meta_item,
                                                  is_sugared_doc: false });
     }
 
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index d5a09e087a0..6230b0465dc 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -904,7 +904,7 @@ pub fn print_attribute(s: @ps, attr: ast::attribute) {
         word(s.s, *comment);
     } else {
         word(s.s, ~"#[");
-        print_meta_item(s, @attr.node.value);
+        print_meta_item(s, attr.node.value);
         word(s.s, ~"]");
     }
 }