diff options
Diffstat (limited to 'src/libsyntax/parse/eval.rs')
| -rw-r--r-- | src/libsyntax/parse/eval.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libsyntax/parse/eval.rs b/src/libsyntax/parse/eval.rs index 54a2abf20c9..125dc809079 100644 --- a/src/libsyntax/parse/eval.rs +++ b/src/libsyntax/parse/eval.rs @@ -9,7 +9,7 @@ type ctx = fn eval_crate_directives(cx: ctx, cdirs: ~[@ast::crate_directive], - prefix: str, + prefix: ~str, &view_items: ~[@ast::view_item], &items: ~[@ast::item]) { for cdirs.each |sub_cdir| { @@ -18,11 +18,11 @@ fn eval_crate_directives(cx: ctx, } fn eval_crate_directives_to_mod(cx: ctx, cdirs: ~[@ast::crate_directive], - prefix: str, suffix: option<str>) + prefix: ~str, suffix: option<~str>) -> (ast::_mod, ~[ast::attribute]) { #debug("eval crate prefix: %s", prefix); #debug("eval crate suffix: %s", - option::get_default(suffix, "none")); + option::get_default(suffix, ~"none")); let (cview_items, citems, cattrs) = parse_companion_mod(cx, prefix, suffix); let mut view_items: ~[@ast::view_item] = ~[]; @@ -43,17 +43,17 @@ companion mod is a .rs file with the same name as the directory. 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>) +fn parse_companion_mod(cx: ctx, prefix: ~str, suffix: option<~str>) -> (~[@ast::view_item], ~[@ast::item], ~[ast::attribute]) { - fn companion_file(+prefix: str, suffix: option<str>) -> str { + fn companion_file(+prefix: ~str, suffix: option<~str>) -> ~str { ret alt suffix { option::some(s) { path::connect(prefix, s) } option::none { prefix } - } + ".rs"; + } + ~".rs"; } - fn file_exists(path: str) -> bool { + fn file_exists(path: ~str) -> bool { // Crude, but there's no lib function for this and I'm not // up to writing it just now alt io::file_reader(path) { @@ -78,8 +78,8 @@ fn parse_companion_mod(cx: ctx, prefix: str, suffix: option<str>) } } -fn cdir_path_opt(id: ast::ident, attrs: ~[ast::attribute]) -> @str/~ { - alt ::attr::first_attr_value_str_by_name(attrs, "path") { +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; } @@ -87,12 +87,12 @@ fn cdir_path_opt(id: ast::ident, attrs: ~[ast::attribute]) -> @str/~ { } } -fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: str, +fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: ~str, &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); + let file_path = cdir_path_opt(@(*id + ~".rs"), attrs); let full_path = if path::path_is_absolute(*file_path) { *file_path |
