about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-01-11 12:52:25 -0800
committerNiko Matsakis <niko@alum.mit.edu>2012-01-13 06:27:35 -0800
commit3f3bfeec27c3457de30929d7dbf914a5b350808c (patch)
treedb38c6f0d28f66e58ecaee44713f7dba432dd15c /src/comp
parent455f8b0d4588b6d890ce8a908d488c0325e3f29e (diff)
make "native fn" the type for bare functions, remove fn exprs
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/metadata/encoder.rs2
-rw-r--r--src/comp/syntax/print/pprust.rs15
2 files changed, 12 insertions, 5 deletions
diff --git a/src/comp/metadata/encoder.rs b/src/comp/metadata/encoder.rs
index e7890e9e926..537c420aa71 100644
--- a/src/comp/metadata/encoder.rs
+++ b/src/comp/metadata/encoder.rs
@@ -483,7 +483,7 @@ fn create_index<T: copy>(index: [entry<T>], hash_fn: fn@(T) -> uint) ->
 
 fn encode_index<T>(ebml_w: ebml::writer, buckets: [@[entry<T>]],
                    write_fn: block(io::writer, T)) {
-    let writer = io::new_writer(ebml_w.writer);
+    let writer = ebml_w.writer;
     ebml::start_tag(ebml_w, tag_index);
     let bucket_locs: [uint] = [];
     ebml::start_tag(ebml_w, tag_index_buckets);
diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs
index 6c5fd6b0354..d1289488b36 100644
--- a/src/comp/syntax/print/pprust.rs
+++ b/src/comp/syntax/print/pprust.rs
@@ -304,7 +304,7 @@ fn print_type(s: ps, &&ty: @ast::ty) {
         pclose(s);
       }
       ast::ty_fn(proto, d) {
-        print_ty_fn(s, proto, d, none, none);
+        print_ty_fn(s, some(proto), d, none, none);
       }
       ast::ty_path(path, _) { print_path(s, path, false); }
       ast::ty_type. { word(s.s, "type"); }
@@ -485,7 +485,7 @@ fn print_ty_method(s: ps, m: ast::ty_method) {
     hardbreak_if_not_bol(s);
     cbox(s, indent_unit);
     maybe_print_comment(s, m.span.lo);
-    print_ty_fn(s, ast::proto_bare, m.decl, some(m.ident), some(m.tps));
+    print_ty_fn(s, none, m.decl, some(m.ident), some(m.tps));
     word(s.s, ";");
     end(s);
 }
@@ -1320,11 +1320,11 @@ fn print_mt(s: ps, mt: ast::mt) {
     print_type(s, mt.ty);
 }
 
-fn print_ty_fn(s: ps, proto: ast::proto,
+fn print_ty_fn(s: ps, opt_proto: option<ast::proto>,
                decl: ast::fn_decl, id: option::t<ast::ident>,
                tps: option::t<[ast::ty_param]>) {
     ibox(s, indent_unit);
-    word(s.s, proto_to_str(proto));
+    word(s.s, opt_proto_to_str(opt_proto));
     alt id { some(id) { word(s.s, " "); word(s.s, id); } _ { } }
     alt tps { some(tps) { print_type_params(s, tps); } _ { } }
     zerobreak(s.s);
@@ -1602,6 +1602,13 @@ fn ast_fn_constrs_str(decl: ast::fn_decl, constrs: [@ast::constr]) -> str {
     ret s;
 }
 
+fn opt_proto_to_str(opt_p: option<ast::proto>) -> str {
+    alt opt_p {
+      none. { "fn" }
+      some(p) { proto_to_str(p) }
+    }
+}
+
 fn proto_to_str(p: ast::proto) -> str {
     ret alt p {
           ast::proto_bare. { "native fn" }