diff options
| author | Patrick Walton <[email protected]> | 2010-11-03 17:10:37 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-11-05 11:18:40 -0700 |
| commit | adb1754e4dcbf61abb93ac7604aed4e8bca080a8 (patch) | |
| tree | 037acbf63e189a999291e04a9a9db4e777e9c003 /src/comp/front | |
| parent | rustboot: Report cyclic import errors at the right location (diff) | |
| download | rust-adb1754e4dcbf61abb93ac7604aed4e8bca080a8.tar.xz rust-adb1754e4dcbf61abb93ac7604aed4e8bca080a8.zip | |
Move the option type to its own module
Diffstat (limited to 'src/comp/front')
| -rw-r--r-- | src/comp/front/ast.rs | 15 | ||||
| -rw-r--r-- | src/comp/front/parser.rs | 14 |
2 files changed, 14 insertions, 15 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs index e635c119..a6cbf1ce 100644 --- a/src/comp/front/ast.rs +++ b/src/comp/front/ast.rs @@ -1,7 +1,6 @@ -import util.common.option; import std.map.hashmap; -import std.util.option; +import std.option; import util.common.span; import util.common.spanned; @@ -71,16 +70,16 @@ tag unop { type stmt = spanned[stmt_]; tag stmt_ { stmt_decl(@decl); - stmt_ret(option[@expr]); + stmt_ret(option.t[@expr]); stmt_log(@expr); stmt_check_expr(@expr); stmt_expr(@expr); } -type local = rec(option[@ty] ty, +type local = rec(option.t[@ty] ty, bool infer, ident ident, - option[@expr] init, + option.t[@expr] init, def_id id); type decl = spanned[decl_]; @@ -99,14 +98,14 @@ tag expr_ { expr_unary(unop, @expr, ann); expr_lit(@lit, ann); expr_cast(@expr, @ty, ann); - expr_if(@expr, block, option[block], ann); + expr_if(@expr, block, option.t[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); + expr_name(name, option.t[def], ann); } type lit = spanned[lit_]; @@ -131,7 +130,7 @@ tag ty_ { ty_box(@ty); ty_vec(@ty); ty_tup(vec[tup(bool /* mutability */, @ty)]); - ty_path(path, option[def]); + ty_path(path, option.t[def]); } tag mode { diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs index d42f7b45..6eb334ca 100644 --- a/src/comp/front/parser.rs +++ b/src/comp/front/parser.rs @@ -1,7 +1,7 @@ import std._io; -import std.util.option; -import std.util.some; -import std.util.none; +import std.option; +import std.option.some; +import std.option.none; import std.map.hashmap; import driver.session; @@ -157,7 +157,7 @@ impure fn parse_arg(parser p) -> ast.arg { impure fn parse_seq[T](token.token bra, token.token ket, - option[token.token] sep, + option.t[token.token] sep, (impure fn(parser) -> T) f, parser p) -> util.common.spanned[vec[T]] { let bool first = true; @@ -185,7 +185,7 @@ impure fn parse_seq[T](token.token bra, ret spanned(lo, hi, v); } -impure fn parse_lit(parser p) -> option[ast.lit] { +impure fn parse_lit(parser p) -> option.t[ast.lit] { auto lo = p.get_span(); let ast.lit_ lit; alt (p.peek()) { @@ -600,7 +600,7 @@ impure fn parse_if_expr(parser p) -> @ast.expr { auto cond = parse_expr(p); expect(p, token.RPAREN); auto thn = parse_block(p); - let option[ast.block] els = none[ast.block]; + let option.t[ast.block] els = none[ast.block]; hi = thn.span; alt (p.peek()) { case (token.ELSE) { @@ -664,7 +664,7 @@ impure fn parse_expr(parser p) -> @ast.expr { } } -impure fn parse_initializer(parser p) -> option[@ast.expr] { +impure fn parse_initializer(parser p) -> option.t[@ast.expr] { if (p.peek() == token.EQ) { p.bump(); ret some(parse_expr(p)); |