aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-16 18:34:04 -0800
committerGraydon Hoare <[email protected]>2010-12-16 18:34:04 -0800
commita3f828f941439276092fe1c0d091de746d35d42e (patch)
tree6b026fc59a64ac7b89d680d4fce2278f780eba58 /src
parentrustc: Translate parametric function signatures into task + type parameters +... (diff)
downloadrust-a3f828f941439276092fe1c0d091de746d35d42e.tar.xz
rust-a3f828f941439276092fe1c0d091de746d35d42e.zip
Sketch trans_vtbl.
Diffstat (limited to 'src')
-rw-r--r--src/comp/front/ast.rs4
-rw-r--r--src/comp/front/parser.rs5
-rw-r--r--src/comp/middle/trans.rs9
3 files changed, 14 insertions, 4 deletions
diff --git a/src/comp/front/ast.rs b/src/comp/front/ast.rs
index 88b7fc78..f4e5e5e1 100644
--- a/src/comp/front/ast.rs
+++ b/src/comp/front/ast.rs
@@ -199,10 +199,10 @@ type _fn = rec(effect effect,
block body);
-type method_ = rec(ident ident, _fn meth, def_id id);
+type method_ = rec(ident ident, _fn meth, def_id id, ann ann);
type method = spanned[method_];
-type obj_field = rec(@ty ty, ident ident, def_id id);
+type obj_field = rec(@ty ty, ident ident, def_id id, ann ann);
type _obj = rec(vec[obj_field] fields,
vec[@method] methods);
diff --git a/src/comp/front/parser.rs b/src/comp/front/parser.rs
index 3eacb5f9..cd4ef3e1 100644
--- a/src/comp/front/parser.rs
+++ b/src/comp/front/parser.rs
@@ -1285,7 +1285,7 @@ impure fn parse_item_fn(parser p, ast.effect eff) -> @ast.item {
impure fn parse_obj_field(parser p) -> ast.obj_field {
auto ty = parse_ty(p);
auto ident = parse_ident(p);
- ret rec(ty=ty, ident=ident, id=p.next_def_id());
+ ret rec(ty=ty, ident=ident, id=p.next_def_id(), ann=ast.ann_none);
}
impure fn parse_method(parser p) -> @ast.method {
@@ -1294,7 +1294,8 @@ impure fn parse_method(parser p) -> @ast.method {
expect(p, token.FN);
auto ident = parse_ident(p);
auto f = parse_fn(p, eff);
- auto meth = rec(ident = ident, meth = f, id = p.next_def_id());
+ auto meth = rec(ident=ident, meth=f,
+ id=p.next_def_id(), ann=ast.ann_none);
ret @spanned(lo, f.body.span, meth);
}
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index 8b094ffc..e8225677 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -2307,6 +2307,15 @@ impure fn trans_fn(@crate_ctxt cx, &ast._fn f, ast.def_id fid,
}
}
+impure fn trans_vtbl(@crate_ctxt cx, &ast._obj ob) -> ValueRef {
+ let vec[ValueRef] methods = vec();
+ for (@ast.method m in ob.methods) {
+ trans_fn(cx, m.node.meth, m.node.id, m.node.ann);
+ methods += cx.item_ids.get(m.node.id);
+ }
+ ret C_struct(methods);
+}
+
fn trans_obj(@crate_ctxt cx, &ast._obj ob, ast.def_id oid,
&ast.ann ann) {