diff options
| author | Michael Sullivan <sully@msully.net> | 2012-06-25 20:00:46 -0700 |
|---|---|---|
| committer | Michael Sullivan <sully@msully.net> | 2012-06-25 20:00:46 -0700 |
| commit | 329eca6044fdf376a7a89ec7a96dba7a8b884cf7 (patch) | |
| tree | 7008814278a066914b6ba36818388d5212ffda9f /src/libsyntax/parse/eval.rs | |
| parent | c087aaf56b1109163126fea4c2760f8414ffbe56 (diff) | |
| download | rust-329eca6044fdf376a7a89ec7a96dba7a8b884cf7.tar.gz rust-329eca6044fdf376a7a89ec7a96dba7a8b884cf7.zip | |
Make vectors uglier ([]/~). Sorry. Should be temporary. Closes #2725.
Diffstat (limited to 'src/libsyntax/parse/eval.rs')
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index ae11c883443..f1dd8d69cc1 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -7,24 +7,26 @@ type ctx = @{sess: parse::parse_sess, cfg: ast::crate_cfg}; -fn eval_crate_directives(cx: ctx, cdirs: [@ast::crate_directive], prefix: str, - &view_items: [@ast::view_item], - &items: [@ast::item]) { +fn eval_crate_directives(cx: ctx, + cdirs: [@ast::crate_directive]/~, + prefix: str, + &view_items: [@ast::view_item]/~, + &items: [@ast::item]/~) { for cdirs.each {|sub_cdir| eval_crate_directive(cx, sub_cdir, prefix, view_items, items); } } -fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive], +fn eval_crate_directives_to_mod(cx: ctx, cdirs: [@ast::crate_directive]/~, prefix: str, suffix: option<str>) - -> (ast::_mod, [ast::attribute]) { + -> (ast::_mod, [ast::attribute]/~) { #debug("eval crate prefix: %s", prefix); #debug("eval crate suffix: %s", option::get_default(suffix, "none")); let (cview_items, citems, cattrs) = parse_companion_mod(cx, prefix, suffix); - let mut view_items: [@ast::view_item] = []; - let mut items: [@ast::item] = []; + let mut view_items: [@ast::view_item]/~ = []/~; + let mut items: [@ast::item]/~ = []/~; eval_crate_directives(cx, cdirs, prefix, view_items, items); ret ({view_items: view_items + cview_items, items: items + citems}, @@ -42,7 +44,7 @@ We build the path to the companion mod by combining the prefix and the optional suffix then adding the .rs extension. */ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>) - -> ([@ast::view_item], [@ast::item], [ast::attribute]) { + -> ([@ast::view_item]/~, [@ast::item]/~, [ast::attribute]/~) { fn companion_file(+prefix: str, suffix: option<str>) -> str { ret alt suffix { @@ -72,11 +74,11 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>) cx.sess.byte_pos = cx.sess.byte_pos + r0.pos; ret (m0.view_items, m0.items, inner_attrs.inner); } else { - ret ([], [], []); + ret ([]/~, []/~, []/~); } } -fn cdir_path_opt(id: ast::ident, attrs: [ast::attribute]) -> @str { +fn cdir_path_opt(id: ast::ident, attrs: [ast::attribute]/~) -> @str { alt ::attr::first_attr_value_str_by_name(attrs, "path") { some(d) { ret d; @@ -86,8 +88,8 @@ fn cdir_path_opt(id: ast::ident, attrs: [ast::attribute]) -> @str { } fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, - &view_items: [@ast::view_item], - &items: [@ast::item]) { + &view_items: [@ast::view_item]/~, + &items: [@ast::item]/~) { alt cdir.node { ast::cdir_src_mod(id, attrs) { let file_path = cdir_path_opt(@(*id + ".rs"), attrs); @@ -108,7 +110,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, // Thread defids, chpos and byte_pos through the parsers cx.sess.chpos = r0.chpos; cx.sess.byte_pos = cx.sess.byte_pos + r0.pos; - items += [i]; + items += [i]/~; } ast::cdir_dir_mod(id, cdirs, attrs) { let path = cdir_path_opt(id, attrs); @@ -126,9 +128,9 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, vis: ast::public, span: cdir.span}; cx.sess.next_id += 1; - items += [i]; + items += [i]/~; } - ast::cdir_view_item(vi) { view_items += [vi]; } + ast::cdir_view_item(vi) { view_items += [vi]/~; } ast::cdir_syntax(pth) { } } } |
