First step for supporting "case (foo.bar(?zed))": Change the ast of
pat_tag to hold a path.
This commit is contained in:
parent
3339243254
commit
5066937f10
5 changed files with 25 additions and 19 deletions
|
|
@ -55,7 +55,7 @@ type pat = spanned[pat_];
|
|||
tag pat_ {
|
||||
pat_wild(ann);
|
||||
pat_bind(ident, def_id, ann);
|
||||
pat_tag(ident, vec[@pat], option.t[variant_def], ann);
|
||||
pat_tag(path, vec[@pat], option.t[variant_def], ann);
|
||||
}
|
||||
|
||||
tag mutability {
|
||||
|
|
|
|||
|
|
@ -1071,7 +1071,7 @@ impure fn parse_pat(parser p) -> @ast.pat {
|
|||
}
|
||||
}
|
||||
case (token.IDENT(?id)) {
|
||||
p.bump();
|
||||
auto tag_path = parse_path(p, GREEDY);
|
||||
|
||||
let vec[@ast.pat] args;
|
||||
alt (p.peek()) {
|
||||
|
|
@ -1083,7 +1083,8 @@ impure fn parse_pat(parser p) -> @ast.pat {
|
|||
case (_) { args = vec(); }
|
||||
}
|
||||
|
||||
pat = ast.pat_tag(id, args, none[ast.variant_def], ast.ann_none);
|
||||
pat = ast.pat_tag(tag_path, args, none[ast.variant_def],
|
||||
ast.ann_none);
|
||||
}
|
||||
case (?tok) {
|
||||
p.err("expected pattern but found " + token.to_str(tok));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue