aboutsummaryrefslogtreecommitdiff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <[email protected]>2010-12-21 16:43:28 -0800
committerGraydon Hoare <[email protected]>2010-12-21 16:43:28 -0800
commit3504f4a4bf492886aa6cc7b2eae5d8e0100e9d51 (patch)
treeab9592156d3e9de9ce6811cbf508a7e94f1fe4d5 /src/comp
parentrustc: Move type logic out of typeck so trans doesn't look like it's calling ... (diff)
downloadrust-3504f4a4bf492886aa6cc7b2eae5d8e0100e9d51.tar.xz
rust-3504f4a4bf492886aa6cc7b2eae5d8e0100e9d51.zip
Sort methods in object types.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/typeck.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/comp/middle/typeck.rs b/src/comp/middle/typeck.rs
index 8994d72d..32e80d9b 100644
--- a/src/comp/middle/typeck.rs
+++ b/src/comp/middle/typeck.rs
@@ -248,6 +248,13 @@ fn collect_item_types(@ast.crate crate) -> tup(@ast.crate, @ty_table) {
auto methods =
_vec.map[@ast.method,method](f, obj_info.methods);
+ fn method_lteq(&method a, &method b) -> bool {
+ ret _str.lteq(a.ident, b.ident);
+ }
+
+ methods = std.sort.merge_sort[method](bind method_lteq(_,_),
+ methods);
+
auto t_obj = plain_ty(ty.ty_obj(methods));
ret t_obj;
}