Skip to content

Commit d3a0f7e

Browse files
committed
emit mthd data if marked inline
1 parent 6473a87 commit d3a0f7e

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/comp/metadata/encoder.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,8 @@ type abbrev_map = map::hashmap<ty::t, tyencode::ty_abbrev>;
2929

3030
type encode_ctxt = {ccx: crate_ctxt, type_abbrevs: abbrev_map};
3131

32-
fn should_inline(path: ast_map::path, item: @item) -> bool {
33-
if item.ident == "iter" { // XXX
34-
#debug["should_inline(%s::%s)? attrs=%s result=%b",
35-
ast_map::path_to_str(path),
36-
item.ident,
37-
str::connect(vec::map(item.attrs, pprust::attr_to_str), ", "),
38-
attr::attrs_contains_name(item.attrs, "inline")];
39-
}
40-
41-
attr::attrs_contains_name(item.attrs, "inline")
32+
fn should_inline(_path: ast_map::path, attrs: [attribute]) -> bool {
33+
attr::attrs_contains_name(attrs, "inline")
4234
}
4335

4436
// Path table encoding
@@ -351,7 +343,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
351343
encode_type(ecx, ebml_w, node_id_to_type(tcx, item.id));
352344
encode_symbol(ecx, ebml_w, item.id);
353345
encode_path(ebml_w, path, ast_map::path_name(item.ident));
354-
if should_inline(path, item) {
346+
if should_inline(path, item.attrs) {
355347
astencode::encode_inlined_item(ecx, ebml_w, path, ii_item(item));
356348
}
357349
ebml_w.end_tag();
@@ -454,6 +446,11 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::writer, item: @item,
454446
encode_name(ebml_w, m.ident);
455447
encode_symbol(ecx, ebml_w, m.id);
456448
encode_path(ebml_w, impl_path, ast_map::path_name(m.ident));
449+
if should_inline(path, m.attrs) {
450+
astencode::encode_inlined_item(
451+
ecx, ebml_w, impl_path,
452+
ii_method(local_def(item.id), m));
453+
}
457454
ebml_w.end_tag();
458455
}
459456
}

0 commit comments

Comments
 (0)