rustc: encode is_sugared_doc on ast::Attribute

This commit is contained in:
Corey Richardson 2014-07-28 01:02:31 -07:00
parent fc08779185
commit 8876ce44c5
3 changed files with 7 additions and 1 deletions

View File

@ -231,3 +231,5 @@ pub static tag_unboxed_closure_type: uint = 0x97;
pub static tag_struct_fields: uint = 0x98;
pub static tag_struct_field: uint = 0x99;
pub static tag_struct_field_id: uint = 0x9a;
pub static tag_attribute_is_sugared_doc: uint = 0x9b;

View File

@ -1056,6 +1056,9 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
match reader::maybe_get_doc(md, tag_attributes) {
Some(attrs_d) => {
reader::tagged_docs(attrs_d, tag_attribute, |attr_doc| {
let is_sugared_doc = reader::doc_as_u8(
reader::get_doc(attr_doc, tag_attribute_is_sugared_doc)
) == 1;
let meta_items = get_meta_items(attr_doc);
// Currently it's only possible to have a single meta item on
// an attribute
@ -1067,7 +1070,7 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
id: attr::mk_attr_id(),
style: ast::AttrOuter,
value: meta_item,
is_sugared_doc: false,
is_sugared_doc: is_sugared_doc,
},
span: codemap::DUMMY_SP
});

View File

@ -1490,6 +1490,7 @@ fn encode_attributes(ebml_w: &mut Encoder, attrs: &[Attribute]) {
ebml_w.start_tag(tag_attributes);
for attr in attrs.iter() {
ebml_w.start_tag(tag_attribute);
ebml_w.wr_tagged_u8(tag_attribute_is_sugared_doc, attr.node.is_sugared_doc as u8);
encode_meta_item(ebml_w, attr.node.value);
ebml_w.end_tag();
}