aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-31 15:05:22 -0800
committerGraydon Hoare <[email protected]>2010-12-31 15:05:22 -0800
commit1b0da12fe8b8c9391c73f977a075448835b647e9 (patch)
tree6174062e988601b2c75037737f8634245fa13f83 /src/comp
parentChange resolve errs to span_errs. (diff)
downloadrust-1b0da12fe8b8c9391c73f977a075448835b647e9.tar.xz
rust-1b0da12fe8b8c9391c73f977a075448835b647e9.zip
Update method-fold env with fake item_fn representing the method.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/fold.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/comp/middle/fold.rs b/src/comp/middle/fold.rs
index 54570709..31ccd821 100644
--- a/src/comp/middle/fold.rs
+++ b/src/comp/middle/fold.rs
@@ -663,8 +663,19 @@ fn fold_obj[ENV](&ENV env, ast_fold[ENV] fld, &ast._obj ob) -> ast._obj {
for (ast.obj_field f in ob.fields) {
fields += fold_obj_field(env, fld, f);
}
+ let vec[ast.ty_param] tp = vec();
for (@ast.method m in ob.methods) {
- append[@ast.method](meths, fold_method(env, fld, m));
+ // Fake-up an ast.item for this method.
+ // FIXME: this is kinda awful. Maybe we should reformulate
+ // the way we store methods in the AST?
+ let @ast.item i = @rec(node=ast.item_fn(m.node.ident,
+ m.node.meth,
+ tp,
+ m.node.id,
+ m.node.ann),
+ span=m.span);
+ let ENV _env = fld.update_env_for_item(env, i);
+ append[@ast.method](meths, fold_method(_env, fld, m));
}
ret fld.fold_obj(env, fields, meths);
}