rustc: Parse by-reference pattern bindings with the "ref" keyword

This commit is contained in:
Patrick Walton
2012-07-31 19:25:24 -07:00
parent a841789a41
commit b414db041b
25 changed files with 203 additions and 146 deletions

View File

@@ -145,6 +145,12 @@ type pat = {id: node_id, node: pat_, span: span};
#[auto_serialize]
type field_pat = {ident: ident, pat: @pat};
#[auto_serialize]
enum binding_mode {
bind_by_value,
bind_by_ref
}
#[auto_serialize]
enum pat_ {
pat_wild,
@@ -155,7 +161,7 @@ enum pat_ {
// which it is. The resolver determines this, and
// records this pattern's node_id in an auxiliary
// set (of "pat_idents that refer to nullary enums")
pat_ident(@path, option<@pat>),
pat_ident(binding_mode, @path, option<@pat>),
pat_enum(@path, option<~[@pat]>), // "none" means a * pattern where
// we don't bind the fields to names
pat_rec(~[field_pat], bool),