aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLindsey Kuper <[email protected]>2011-05-13 17:26:14 -0700
committerGraydon Hoare <[email protected]>2011-05-13 17:37:01 -0700
commit5679f5c55e15e4a42542c36b1abc86b469903d19 (patch)
tree05e621c2d05f678d2a15cbb70de7f09163619ef3 /src
parentMore anon obj work; whitespace police in middle::fold (diff)
downloadrust-5679f5c55e15e4a42542c36b1abc86b469903d19.tar.xz
rust-5679f5c55e15e4a42542c36b1abc86b469903d19.zip
'with' no longer a token; whitespace police.
Plus renaming the anonymous objects test to a more descriptive name, and XFAILing it because it doesn't work yet.
Diffstat (limited to 'src')
-rw-r--r--src/comp/front/parser.rs14
-rw-r--r--src/comp/middle/typeck.rs18
-rw-r--r--src/test/run-pass/anon-objs.rs (renamed from src/test/run-pass/method-overriding.rs)1
3 files changed, 15 insertions, 18 deletions
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 8eb6c398..767e7e93 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -801,15 +801,11 @@ fn parse_bottom_expr(parser p) -> @ast::expr {
expect(p, token::LBRACE);
while (p.peek() != token::RBRACE) {
- alt (p.peek()) {
- case (token::WITH) {
- p.bump();
- with_obj = some[ast::ident](parse_ident(p));
- }
- case (_) {
- _vec::push[@ast::method](meths,
- parse_method(p));
- }
+ if (eat_word(p, "with")) {
+ with_obj = some[ast::ident](parse_ident(p));
+ } else {
+ _vec::push[@ast::method](meths,
+ parse_method(p));
}
}
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 99b2111e..3a620fa7 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -762,7 +762,7 @@ mod Collect {
}
}
}
-
+
// Anonymous objects are expressions, not items, but they're enough like
// items that we're going to include them in this fold.
fn fold_expr_anon_obj(&@env e, &span sp,
@@ -1544,8 +1544,8 @@ mod Pushdown {
write_type_only(fcx.ccx.node_types, ast::ann_tag(ann), t);
}
/* FIXME: should this check the type annotations? */
- case (ast::expr_fail(_)) { e_1 = e.node; }
- case (ast::expr_log(_,_,_)) { e_1 = e.node; }
+ case (ast::expr_fail(_)) { e_1 = e.node; }
+ case (ast::expr_log(_,_,_)) { e_1 = e.node; }
case (ast::expr_break(_)) { e_1 = e.node; }
case (ast::expr_cont(_)) { e_1 = e.node; }
case (ast::expr_ret(_,_)) { e_1 = e.node; }
@@ -2262,7 +2262,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
+ "slot variables or literals");
}
}
-
+
require_pure_function(fcx.ccx, d_id, expr.span);
ret @fold::respan[ast::expr_]
@@ -2574,7 +2574,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
case (ast::expr_call(?f, ?args, ?a)) {
/* here we're kind of hosed, as f can be any expr
need to restrict it to being an explicit expr_path if we're
- inside a pure function, and need an environment mapping from
+ inside a pure function, and need an environment mapping from
function name onto purity-designation */
require_pure_call(fcx.ccx, fcx.purity, f, expr.span);
@@ -2613,10 +2613,10 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
}
// Otherwise, we should be able to look up the object we're
// "with".
- case (_) {
+ case (_) {
// TODO.
-
- fail;
+
+ fail;
}
}
@@ -2886,7 +2886,7 @@ fn check_expr(&@fn_ctxt fcx, &@ast::expr expr) -> @ast::expr {
expr_ty(fcx.ccx.tcx, fcx.ccx.node_types, base_1));
auto idx_1 = check_expr(fcx, idx);
- auto idx_t = expr_ty(fcx.ccx.tcx, fcx.ccx.node_types, idx_1);
+ auto idx_t = expr_ty(fcx.ccx.tcx, fcx.ccx.node_types, idx_1);
alt (struct(fcx.ccx.tcx, base_t)) {
case (ty::ty_vec(?mt)) {
if (! type_is_integral(fcx.ccx.tcx, idx_t)) {
diff --git a/src/test/run-pass/method-overriding.rs b/src/test/run-pass/anon-objs.rs
index c76123fe..14279db2 100644
--- a/src/test/run-pass/method-overriding.rs
+++ b/src/test/run-pass/anon-objs.rs
@@ -1,5 +1,6 @@
// xfail-boot
// xfail-stage0
+// xfail-stage1
use std;
fn main() {