diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-05 11:46:38 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-06 14:44:43 -0800 |
| commit | 7c7559edafcdde2d96781a34af1280fdd1dee6bd (patch) | |
| tree | 167b04cf99e3e4f00d28f0dc44e0984f4938134c /src/comp/metadata | |
| parent | da519c8587c46ec519fada1aee7cc32ed2c1cd6a (diff) | |
| download | rust-7c7559edafcdde2d96781a34af1280fdd1dee6bd.tar.gz rust-7c7559edafcdde2d96781a34af1280fdd1dee6bd.zip | |
Disallow variable names that shadow tags in scope
Now, if you have a tag named "foo", a variable declaration like "let foo..." is illegal. This change makes it possible to eliminate the '.' after a nullary tag pattern in an alt (but I'll be doing that in a future commit) -- as now it's always obvious whether a name refers to a tag or a new declared variable. resolve implements this change -- all the other changes are just to get rid of existing code that declares variables that shadow tag names.
Diffstat (limited to 'src/comp/metadata')
| -rw-r--r-- | src/comp/metadata/tydecode.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/comp/metadata/tydecode.rs b/src/comp/metadata/tydecode.rs index 4ba9ae3fade..e339f4bc92e 100644 --- a/src/comp/metadata/tydecode.rs +++ b/src/comp/metadata/tydecode.rs @@ -305,13 +305,13 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t { } fn parse_mt(st: @pstate, conv: conv_did) -> ty::mt { - let mut; + let m; alt peek(st) as char { - 'm' { next(st); mut = ast::mut; } - '?' { next(st); mut = ast::maybe_mut; } - _ { mut = ast::imm; } + 'm' { next(st); m = ast::mut; } + '?' { next(st); m = ast::maybe_mut; } + _ { m = ast::imm; } } - ret {ty: parse_ty(st, conv), mut: mut}; + ret {ty: parse_ty(st, conv), mut: m}; } fn parse_def(st: @pstate, conv: conv_did) -> ast::def_id { |
