From 4fc8de196977a0e5bb4f733f7aaeb1162e880eaa Mon Sep 17 00:00:00 2001 From: Lindsey Kuper Date: Tue, 5 Apr 2011 16:17:47 -0700 Subject: Last pieces of self-call support. The last few pieces of the hack that lets us use trans.trans_call() to translate self-calls, plus a fix for the parser buy that was preventing self-call expressions from getting past parsing. test/run-pass/obj-self.rs works now (as in it actually prints "hi!" twice!). --- src/comp/middle/ty.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/comp/middle/ty.rs') diff --git a/src/comp/middle/ty.rs b/src/comp/middle/ty.rs index 24bd647f..f83bece7 100644 --- a/src/comp/middle/ty.rs +++ b/src/comp/middle/ty.rs @@ -26,6 +26,12 @@ type method = rec(ast.proto proto, type mt = rec(@t ty, ast.mutability mut); +// Convert from method type to function type. Pretty easy; we just drop +// 'ident'. +fn method_ty_to_fn_ty(method m) -> @ty.t { + ret plain_ty(ty_fn(m.proto, m.inputs, m.output)); +} + // NB: If you change this, you'll probably want to change the corresponding // AST structure in front/ast.rs as well. type t = rec(sty struct, option.t[str] cname); -- cgit v1.2.3