diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-08-01 16:04:34 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-08-01 16:04:56 -0700 |
| commit | fd536d9d3e5a54b0a7b551a795198210fc229da3 (patch) | |
| tree | 3f95153b40c0bd47428ef68cfb9df4eff09e4ac6 /src/libsyntax/parse | |
| parent | 4991cc5d19a61da91345e9a324c0ea4b8d1b923d (diff) | |
| download | rust-fd536d9d3e5a54b0a7b551a795198210fc229da3.tar.gz rust-fd536d9d3e5a54b0a7b551a795198210fc229da3.zip | |
libsyntax: Use the keyword "copy" for copy-mode bindings instead of the +.
Mea culpa for introducing + in the first place.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f97ddaf9150..78768ea7f35 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1693,7 +1693,7 @@ class parser { } } tok { - if (!is_ident(tok) && tok != token::BINOP(token::PLUS)) || + if !is_ident(tok) || self.is_keyword(~"true") || self.is_keyword(~"false") { let val = self.parse_expr_res(RESTRICT_NO_BAR_OP); if self.eat_keyword(~"to") { @@ -1708,22 +1708,14 @@ class parser { let binding_mode; if self.eat_keyword(~"ref") { binding_mode = bind_by_ref; + } else if self.eat_keyword(~"copy") { + binding_mode = bind_by_value; + } else if refutable { + // XXX: Should be bind_by_value, but that's not + // backward compatible. + binding_mode = bind_by_ref; } else { - alt self.token { - token::BINOP(token::PLUS) => { - // XXX: Temporary thing pending a snapshot. - self.bump(); - binding_mode = bind_by_value; - } - _ if refutable => { - // XXX: Should be bind_by_value, but that's not - // backward compatible. - binding_mode = bind_by_ref; - } - _ => { - binding_mode = bind_by_value; - } - } + binding_mode = bind_by_value; } if is_plain_ident(self.token) && |
