From 91809a17ac462e714e87b0150c0c525e52f69556 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Thu, 30 Dec 2010 17:46:56 -0800 Subject: [PATCH] Teach typeck.ast_ty_to_ty about ty_obj. --- src/comp/middle/typeck.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs index 229a15bbeb8..76a272b391b 100644 --- a/src/comp/middle/typeck.rs +++ b/src/comp/middle/typeck.rs @@ -108,7 +108,7 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty.t { case (ast.ty_fn(?inputs, ?output)) { auto f = bind ast_arg_to_arg(getter, _); - auto i = _vec.map[rec(ast.mode mode, @ast.ty ty),arg](f, inputs); + auto i = _vec.map[ast.ty_arg, arg](f, inputs); sty = ty.ty_fn(i, ast_ty_to_ty(getter, output)); } @@ -134,8 +134,18 @@ fn ast_ty_to_ty(ty_getter getter, &@ast.ty ast_ty) -> @ty.t { cname = t0.cname; } - case (_) { - fail; + case (ast.ty_obj(?meths)) { + let vec[ty.method] tmeths = vec(); + auto f = bind ast_arg_to_arg(getter, _); + for (ast.ty_method m in meths) { + auto ins = _vec.map[ast.ty_arg, arg](f, m.inputs); + auto out = ast_ty_to_ty(getter, m.output); + append[ty.method](tmeths, + rec(ident=m.ident, + inputs=ins, + output=out)); + } + sty = ty.ty_obj(tmeths); } }