Skip to content

Commit ed04bfa

Browse files
committed
---
yaml --- r: 3658 b: refs/heads/master c: 0226f56 h: refs/heads/master v: v3
1 parent 83feece commit ed04bfa

File tree

8 files changed

+76
-76
lines changed

8 files changed

+76
-76
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 7714cb297b5ef54690acaec26cae4828adfceab7
2+
refs/heads/master: 0226f561156e2e01941d643bf261729af4083cae

trunk/src/comp/front/attr.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Functions dealing with attributes and meta_items
22

3+
import std::ivec;
34
import std::vec;
45
import std::str;
56
import std::map;
@@ -28,7 +29,7 @@ export mk_attr;
2829

2930
// From a list of crate attributes get only the meta_items that impact crate
3031
// linkage
31-
fn find_linkage_metas(vec[ast::attribute] attrs) -> vec[@ast::meta_item] {
32+
fn find_linkage_metas(&ast::attribute[] attrs) -> vec[@ast::meta_item] {
3233
let vec[@ast::meta_item] metas = [];
3334
for (ast::attribute attr in find_attrs_by_name(attrs, "link")) {
3435
alt (attr.node.value.node) {
@@ -44,8 +45,8 @@ fn find_linkage_metas(vec[ast::attribute] attrs) -> vec[@ast::meta_item] {
4445
}
4546

4647
// Search a list of attributes and return only those with a specific name
47-
fn find_attrs_by_name(vec[ast::attribute] attrs,
48-
ast::ident name) -> vec[ast::attribute] {
48+
fn find_attrs_by_name(&ast::attribute[] attrs,
49+
ast::ident name) -> ast::attribute[] {
4950
auto filter = bind fn(&ast::attribute a,
5051
ast::ident name) -> option::t[ast::attribute] {
5152
if (get_attr_name(a) == name) {
@@ -54,7 +55,7 @@ fn find_attrs_by_name(vec[ast::attribute] attrs,
5455
option::none
5556
}
5657
} (_, name);
57-
ret vec::filter_map(filter, attrs);
58+
ret ivec::filter_map(filter, attrs);
5859
}
5960

6061
fn get_attr_name(&ast::attribute attr) -> ast::ident {
@@ -101,8 +102,10 @@ fn get_meta_item_value_str(&@ast::meta_item meta) -> option::t[str] {
101102
fn attr_meta(&ast::attribute attr) -> @ast::meta_item { @attr.node.value }
102103

103104
// Get the meta_items from inside a vector of attributes
104-
fn attr_metas(&vec[ast::attribute] attrs) -> vec[@ast::meta_item] {
105-
ret vec::map(attr_meta, attrs);
105+
fn attr_metas(&ast::attribute[] attrs) -> vec[@ast::meta_item] {
106+
auto mitems = [];
107+
for (ast::attribute a in attrs) { mitems += [attr_meta(a)]; }
108+
ret mitems;
106109
}
107110

108111
fn eq(@ast::meta_item a, @ast::meta_item b) -> bool {

trunk/src/comp/front/config.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import std::ivec;
12
import std::option;
23
import std::vec;
34
import syntax::ast;
@@ -97,11 +98,11 @@ fn native_item_in_cfg(&ast::crate_cfg cfg, &@ast::native_item item) -> bool {
9798

9899
// Determine if an item should be translated in the current crate
99100
// configuration based on the item's attributes
100-
fn in_cfg(&ast::crate_cfg cfg, &vec[ast::attribute] attrs) -> bool {
101+
fn in_cfg(&ast::crate_cfg cfg, &ast::attribute[] attrs) -> bool {
101102

102103
// The "cfg" attributes on the item
103104
auto item_cfg_attrs = attr::find_attrs_by_name(attrs, "cfg");
104-
auto item_has_cfg_attrs = vec::len(item_cfg_attrs) > 0u;
105+
auto item_has_cfg_attrs = ivec::len(item_cfg_attrs) > 0u;
105106
if (!item_has_cfg_attrs) { ret true; }
106107

107108
// Pull the inner meta_items from the #[cfg(meta_item, ...)] attributes,

trunk/src/comp/metadata/decoder.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,8 @@ fn get_meta_items(&ebml::doc md) -> vec[@ast::meta_item] {
290290
ret items;
291291
}
292292

293-
fn get_attributes(&ebml::doc md) -> vec[ast::attribute] {
294-
let vec[ast::attribute] attrs = [];
293+
fn get_attributes(&ebml::doc md) -> ast::attribute[] {
294+
let ast::attribute[] attrs = ~[];
295295
alt (ebml::maybe_get_doc(md, tag_attributes)) {
296296
case (option::some(?attrs_d)) {
297297
for each (ebml::doc attr_doc in
@@ -301,9 +301,9 @@ fn get_attributes(&ebml::doc md) -> vec[ast::attribute] {
301301
// an attribute
302302
assert (vec::len(meta_items) == 1u);
303303
auto meta_item = meta_items.(0);
304-
attrs += [rec(node=rec(style=ast::attr_outer,
305-
value=*meta_item),
306-
span=rec(lo=0u, hi=0u))];
304+
attrs += ~[rec(node=rec(style=ast::attr_outer,
305+
value=*meta_item),
306+
span=rec(lo=0u, hi=0u))];
307307
}
308308
}
309309
case (option::none) { }
@@ -327,7 +327,7 @@ fn list_crate_attributes(&ebml::doc md, io::writer out) {
327327
out.write_str("\n\n");
328328
}
329329

330-
fn get_crate_attributes(&vec[u8] data) -> vec[ast::attribute] {
330+
fn get_crate_attributes(&vec[u8] data) -> ast::attribute[] {
331331
ret get_attributes(ebml::new_doc(data));
332332
}
333333

trunk/src/comp/syntax/ast.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ type crate = spanned[crate_];
8787

8888
type crate_ = rec(vec[@crate_directive] directives,
8989
_mod module,
90-
vec[attribute] attrs,
90+
attribute[] attrs,
9191
crate_cfg config);
9292

9393
tag crate_directive_ {
94-
cdir_src_mod(ident, option::t[filename], vec[attribute]);
94+
cdir_src_mod(ident, option::t[filename], attribute[]);
9595
cdir_dir_mod(ident, option::t[filename],
96-
vec[@crate_directive], vec[attribute]);
96+
vec[@crate_directive], attribute[]);
9797
cdir_view_item(@view_item);
9898
cdir_syntax(path);
9999
cdir_auth(path, _auth);
@@ -526,7 +526,7 @@ tag attr_style { attr_outer; attr_inner; }
526526
type attribute_ = rec(attr_style style, meta_item value);
527527

528528
type item = rec(ident ident,
529-
vec[attribute] attrs,
529+
attribute[] attrs,
530530
node_id id, // For objs and resources, this is the type def_id
531531
item_ node,
532532
span span);
@@ -544,7 +544,7 @@ tag item_ {
544544
}
545545

546546
type native_item = rec(ident ident,
547-
vec[attribute] attrs,
547+
attribute[] attrs,
548548
native_item_ node,
549549
node_id id,
550550
span span);

trunk/src/comp/syntax/fold.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,10 @@ fn noop_fold_crate(&crate_ c, ast_fold fld) -> crate_ {
132132
auto fold_meta_item = bind fold_meta_item_(_,fld);
133133
auto fold_attribute = bind fold_attribute_(_,fold_meta_item);
134134

135-
ret rec(directives=map(fld.fold_crate_directive, c.directives),
135+
ret rec(directives=vec::map(fld.fold_crate_directive, c.directives),
136136
module=fld.fold_mod(c.module),
137-
attrs=map(fold_attribute, c.attrs),
138-
config=map(fold_meta_item, c.config));
137+
attrs=ivec::map(fold_attribute, c.attrs),
138+
config=vec::map(fold_meta_item, c.config));
139139
}
140140

141141
fn noop_fold_crate_directive(&crate_directive_ cd, ast_fold fld)
@@ -167,7 +167,7 @@ fn noop_fold_native_item(&@native_item ni, ast_fold fld) -> @native_item {
167167
auto fold_attribute = bind fold_attribute_(_,fold_meta_item);
168168

169169
ret @rec(ident=fld.fold_ident(ni.ident),
170-
attrs=map(fold_attribute, ni.attrs),
170+
attrs=ivec::map(fold_attribute, ni.attrs),
171171
node=alt (ni.node) {
172172
case (native_item_ty) { native_item_ty }
173173
case (native_item_fn(?st, ?fdec, ?typms)) {
@@ -189,7 +189,7 @@ fn noop_fold_item(&@item i, ast_fold fld) -> @item {
189189
auto fold_attribute = bind fold_attribute_(_,fold_meta_item);
190190

191191
ret @rec(ident=fld.fold_ident(i.ident),
192-
attrs=map(fold_attribute,i.attrs),
192+
attrs=ivec::map(fold_attribute,i.attrs),
193193
id=i.id, node=fld.fold_item_underscore(i.node),
194194
span=i.span);
195195
}

0 commit comments

Comments
 (0)