From 87b064b249657c8e65079d01beb77409f69d49cd Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke Date: Thu, 26 Jan 2012 12:26:14 +0100 Subject: First stab at operator overloading When no built-in interpretation is found for one of the operators mentioned below, the typechecker will try to turn it into a method call with the name written next to it. For binary operators, the method will be called on the LHS with the RHS as only parameter. Binary: + op_add - op_sub * op_mul / op_div % op_rem & op_and | op_or ^ op_xor << op_shift_left >> op_shift_right >>> op_ashift_right Unary: - op_neg ! op_not Overloading of the indexing ([]) operator isn't finished yet. Issue #1520 --- src/comp/driver/driver.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/comp/driver') diff --git a/src/comp/driver/driver.rs b/src/comp/driver/driver.rs index e7eafae197a..41130766035 100644 --- a/src/comp/driver/driver.rs +++ b/src/comp/driver/driver.rs @@ -162,12 +162,12 @@ fn compile_upto(sess: session, cfg: ast::crate_cfg, let freevars = time(time_passes, "freevar finding", bind freevars::annotate_freevars(def_map, crate)); - time(time_passes, "const checking", - bind middle::check_const::check_crate(sess, crate)); let ty_cx = ty::mk_ctxt(sess, def_map, ast_map, freevars); let (method_map, dict_map) = time(time_passes, "typechecking", bind typeck::check_crate(ty_cx, impl_map, crate)); + time(time_passes, "const checking", + bind middle::check_const::check_crate(sess, crate, method_map)); if upto == cu_typeck { ret {crate: crate, tcx: some(ty_cx)}; } -- cgit 1.4.1-3-g733a5