Skip to content

Commit 10e3c98

Browse files
committed
---
yaml --- r: 205117 b: refs/heads/tmp c: f97cff9 h: refs/heads/master i: 205115: 7a37c51 v: v3
1 parent b25d3fc commit 10e3c98

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: f0213d8ffb128a16f94af7ee985dc61484596163
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: 77d59217a38e2982fdcf6bff800f1c9acc0d9aaf
35+
refs/heads/tmp: f97cff9abd4ea7a7a8ac24bb9afb09eb271bcda9
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: f0ac7e04e647381e2bb87de1f3d0b108acb24d06
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/src/libsyntax/ext/base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,15 @@ impl MacResult for DummyResult {
418418

419419
/// An enum representing the different kinds of syntax extensions.
420420
pub enum SyntaxExtension {
421+
/// A syntax extension that is attached to an item and creates new items
422+
/// based upon it.
423+
Decorator(Box<ItemDecorator + 'static>),
424+
421425
/// A syntax extension that is attached to an item and creates new items
422426
/// based upon it.
423427
///
424428
/// `#[derive(...)]` is an `ItemDecorator`.
425-
Decorator(Box<ItemDecorator + 'static>),
429+
MultiDecorator(Box<MultiItemDecorator + 'static>),
426430

427431
/// A syntax extension that is attached to an item and modifies it
428432
/// in-place.

branches/tmp/src/libsyntax/ext/expand.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,28 @@ fn expand_annotatable(a: Annotatable,
10961096

10971097
fld.cx.bt_pop();
10981098
}
1099+
MultiDecorator(ref dec) => {
1100+
attr::mark_used(attr);
1101+
1102+
fld.cx.bt_push(ExpnInfo {
1103+
call_site: attr.span,
1104+
callee: NameAndSpan {
1105+
name: mname.get().to_string(),
1106+
format: MacroAttribute,
1107+
span: None
1108+
}
1109+
});
1110+
1111+
// we'd ideally decorator_items.push_all(expand_item(item, fld)),
1112+
// but that double-mut-borrows fld
1113+
let mut items: SmallVector<P<ast::Item>> = SmallVector::zero();
1114+
dec.expand(fld.cx, attr.span, &*attr.node.value, a,
1115+
box |&mut: item| items.push(item));
1116+
decorator_items.extend(items.into_iter()
1117+
.flat_map(|item| expand_item(item, fld).into_iter()));
1118+
1119+
fld.cx.bt_pop();
1120+
}
10991121
_ => new_attrs.push((*attr).clone()),
11001122
},
11011123
_ => new_attrs.push((*attr).clone()),

0 commit comments

Comments
 (0)