aboutsummaryrefslogtreecommitdiff
path: root/src/comp/front/ast.rs
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-11-30 16:31:43 -0800
committerGraydon Hoare <[email protected]>2010-11-30 16:32:00 -0800
commit45043374ff4d4eb48bed52ff8f8251f9cddf239a (patch)
tree7a6e5d2114776a896f5d1f7c70f89f1d68ff1781 /src/comp/front/ast.rs
parentrustc: Add def ids to variants (diff)
downloadrust-45043374ff4d4eb48bed52ff8f8251f9cddf239a.tar.xz
rust-45043374ff4d4eb48bed52ff8f8251f9cddf239a.zip
Tidy up structural types for rec, tup AST and typeck nodes.
Diffstat (limited to 'src/comp/front/ast.rs')
-rw-r--r--src/comp/front/ast.rs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 25cea29e..9b503c71 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -109,11 +109,14 @@ tag decl_ {
type arm = rec(@pat pat, block block);
+type elt = rec(mutability mut, @expr expr);
+type field = rec(mutability mut, ident ident, @expr expr);
+
type expr = spanned[expr_];
tag expr_ {
expr_vec(vec[@expr], ann);
- expr_tup(vec[tup(mutability, @expr)], ann);
- expr_rec(vec[tup(ident,@expr)], ann);
+ expr_tup(vec[elt], ann);
+ expr_rec(vec[field], ann);
expr_call(@expr, vec[@expr], ann);
expr_binary(binop, @expr, @expr, ann);
expr_unary(unop, @expr, ann);
@@ -143,6 +146,7 @@ tag lit_ {
// NB: If you change this, you'll probably want to change the corresponding
// type structure in middle/typeck.rs as well.
+type ty_field = rec(ident ident, @ty ty);
type ty = spanned[ty_];
tag ty_ {
ty_nil;
@@ -155,7 +159,7 @@ tag ty_ {
ty_box(@ty);
ty_vec(@ty);
ty_tup(vec[@ty]);
- ty_rec(vec[tup(ident,@ty)]);
+ ty_rec(vec[ty_field]);
ty_fn(vec[rec(mode mode, @ty ty)], @ty); // TODO: effect
ty_path(path, option.t[def]);
ty_mutable(@ty);