about summary refs log tree commit diff
path: root/src/comp/syntax
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-12-18 19:30:40 +0100
committerMarijn Haverbeke <marijnh@gmail.com>2011-12-18 19:41:44 +0100
commitf4acaf6934bf836e6d3feb14738378366f47bef0 (patch)
tree736fc558d90143d84d62e73cd1159edccb2e4ce7 /src/comp/syntax
parentb36ade1367a2dbca69386b58d225ceafa6a90d57 (diff)
downloadrust-f4acaf6934bf836e6d3feb14738378366f47bef0.tar.gz
rust-f4acaf6934bf836e6d3feb14738378366f47bef0.zip
Only look for a matching method when normal field access fails
We should probalby warn when defining a method foo on {foo: int} etc.

This should reduce the amount of useless typevars that are allocated.

Issue #1227
Diffstat (limited to 'src/comp/syntax')
-rw-r--r--src/comp/syntax/print/pprust.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 54388102f53..9b3d047d435 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -467,11 +467,10 @@ fn print_item(s: ps, &&item: @ast::item) {
         space(s.s);
         bopen(s);
         for meth: @ast::method in _obj.methods {
-            let typarams: [ast::ty_param] = [];
             hardbreak_if_not_bol(s);
             maybe_print_comment(s, meth.span.lo);
             print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
-                     meth.node.ident, typarams, []);
+                     meth.node.ident, meth.node.tps, []);
             word(s.s, " ");
             print_block(s, meth.node.meth.body);
         }
@@ -490,7 +489,7 @@ fn print_item(s: ps, &&item: @ast::item) {
             hardbreak_if_not_bol(s);
             maybe_print_comment(s, meth.span.lo);
             print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
-                     meth.node.ident, [], []);
+                     meth.node.ident, meth.node.tps, []);
             word(s.s, " ");
             print_block(s, meth.node.meth.body);
         }
@@ -964,11 +963,10 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
 
         // Methods
         for meth: @ast::method in anon_obj.methods {
-            let typarams: [ast::ty_param] = [];
             hardbreak_if_not_bol(s);
             maybe_print_comment(s, meth.span.lo);
             print_fn(s, meth.node.meth.decl, meth.node.meth.proto,
-                     meth.node.ident, typarams, []);
+                     meth.node.ident, meth.node.tps, []);
             word(s.s, " ");
             print_block(s, meth.node.meth.body);
         }