diff options
| author | Patrick Walton <[email protected]> | 2010-11-03 15:53:53 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-11-03 15:54:46 -0700 |
| commit | a3d666bfdf3ef87a91eace7b533e433945b06d76 (patch) | |
| tree | f8bffa03b37a27dead809b9e00aec3eba733ae8a /src/comp/front/ast.rs | |
| parent | Fix documentation: it's (&str s) not (str &s). (diff) | |
| download | rust-a3d666bfdf3ef87a91eace7b533e433945b06d76.tar.xz rust-a3d666bfdf3ef87a91eace7b533e433945b06d76.zip | |
rustc: Use an extensible annotation field instead of putting option[@ty] everywhere
Diffstat (limited to 'src/comp/front/ast.rs')
| -rw-r--r-- | src/comp/front/ast.rs | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index 32317812..e635c119 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -15,6 +15,12 @@ type crate_num = int; type def_num = int; type def_id = tup(crate_num, def_num); +// Annotations added during successive passes. +tag ann { + ann_none; + ann_type(@ty); +} + tag def { def_fn(def_id); def_mod(def_id); @@ -85,22 +91,22 @@ tag decl_ { type expr = spanned[expr_]; tag expr_ { - expr_vec(vec[@expr], option[@ty]); - expr_tup(vec[tup(bool /* mutability */, @expr)], option[@ty]); - expr_rec(vec[tup(ident,@expr)], option[@ty]); - expr_call(@expr, vec[@expr], option[@ty]); - expr_binary(binop, @expr, @expr, option[@ty]); - expr_unary(unop, @expr, option[@ty]); - expr_lit(@lit, option[@ty]); - expr_cast(@expr, @ty); - expr_if(@expr, block, option[block], option[@ty]); - expr_while(@expr, block, option[@ty]); - expr_do_while(block, @expr, option[@ty]); - expr_block(block, option[@ty]); - expr_assign(@expr /* TODO: @expr|is_lval */, @expr, option[@ty]); - expr_field(@expr, ident, option[@ty]); - expr_index(@expr, @expr, option[@ty]); - expr_name(name, option[def], option[@ty]); + expr_vec(vec[@expr], ann); + expr_tup(vec[tup(bool /* mutability */, @expr)], ann); + expr_rec(vec[tup(ident,@expr)], ann); + expr_call(@expr, vec[@expr], ann); + expr_binary(binop, @expr, @expr, ann); + expr_unary(unop, @expr, ann); + expr_lit(@lit, ann); + expr_cast(@expr, @ty, ann); + expr_if(@expr, block, option[block], ann); + expr_while(@expr, block, ann); + expr_do_while(block, @expr, ann); + expr_block(block, ann); + expr_assign(@expr /* TODO: @expr|is_lval */, @expr, ann); + expr_field(@expr, ident, ann); + expr_index(@expr, @expr, ann); + expr_name(name, option[def], ann); } type lit = spanned[lit_]; |