From fd536d9d3e5a54b0a7b551a795198210fc229da3 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Wed, 1 Aug 2012 16:04:34 -0700 Subject: libsyntax: Use the keyword "copy" for copy-mode bindings instead of the +. Mea culpa for introducing + in the first place. --- src/libsyntax/parse/parser.rs | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'src/libsyntax/parse/parser.rs') 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) && -- cgit 1.4.1-3-g733a5