diff options
| author | Graydon Hoare <[email protected]> | 2011-01-13 17:42:28 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2011-01-13 17:42:28 -0800 |
| commit | f3c3fc03537d9aca36b0ce5956ab8d5b760784b4 (patch) | |
| tree | 802723cba8094d8aba500e9a8d6774c86ea2f54a /src/comp/middle/ty.rs | |
| parent | Add or enable some tests. (diff) | |
| download | rust-f3c3fc03537d9aca36b0ce5956ab8d5b760784b4.tar.xz rust-f3c3fc03537d9aca36b0ce5956ab8d5b760784b4.zip | |
Change single-ident expr_ident to greedy/fat multi-ident expr_path, to handle the module-path/value-indexing distinction.
Diffstat (limited to 'src/comp/middle/ty.rs')
| -rw-r--r-- | src/comp/middle/ty.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index ff54a0a1..b55e8be6 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -146,22 +146,17 @@ fn ast_ty_to_str(&@ast.ty ty) -> str { ret s; } -fn name_to_str(&ast.name nm) -> str { - auto result = nm.node.ident; - if (_vec.len[@ast.ty](nm.node.types) > 0u) { +fn path_to_str(&ast.path pth) -> str { + auto result = _str.connect(pth.node.idents, "."); + if (_vec.len[@ast.ty](pth.node.types) > 0u) { auto f = ast_ty_to_str; result += "["; - result += _str.connect(_vec.map[@ast.ty,str](f, nm.node.types), ","); + result += _str.connect(_vec.map[@ast.ty,str](f, pth.node.types), ","); result += "]"; } ret result; } -fn path_to_str(&ast.path path) -> str { - auto f = name_to_str; - ret _str.connect(_vec.map[ast.name,str](f, path), "."); -} - fn ty_to_str(&@t typ) -> str { fn fn_input_to_str(&rec(ast.mode mode, @t ty) input) -> str { @@ -632,7 +627,7 @@ fn expr_ty(@ast.expr expr) -> @t { { ret ann_to_type(ann); } case (ast.expr_field(_, _, ?ann)) { ret ann_to_type(ann); } case (ast.expr_index(_, _, ?ann)) { ret ann_to_type(ann); } - case (ast.expr_name(_, _, ?ann)) { ret ann_to_type(ann); } + case (ast.expr_path(_, _, ?ann)) { ret ann_to_type(ann); } } fail; } @@ -697,7 +692,7 @@ fn is_lval(@ast.expr expr) -> bool { alt (expr.node) { case (ast.expr_field(_,_,_)) { ret true; } case (ast.expr_index(_,_,_)) { ret true; } - case (ast.expr_name(_,_,_)) { ret true; } + case (ast.expr_path(_,_,_)) { ret true; } case (_) { ret false; } } } @@ -1238,3 +1233,11 @@ fn resolve_ty_params(@ast.item item, @t monoty) -> vec[@t] { ret result_tys; } +// Local Variables: +// mode: rust +// fill-column: 78; +// indent-tabs-mode: nil +// c-basic-offset: 4 +// buffer-file-coding-system: utf-8-unix +// compile-command: "make -k -C ../.. 2>&1 | sed -e 's/\\/x\\//x:\\//g'"; +// End: |