about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-07 18:10:06 -0700
committerBrian Anderson <banderson@mozilla.com>2012-08-08 18:19:24 -0700
commit6a0720b439a4692f55d3b9951e74d452a7aef802 (patch)
treed2dd72702f32e0254f7d72dd5782a8b6741d0004 /src/libsyntax/ext
parente997948c8a70d76ffac3c60867d47f98e698988f (diff)
downloadrust-6a0720b439a4692f55d3b9951e74d452a7aef802.tar.gz
rust-6a0720b439a4692f55d3b9951e74d452a7aef802.zip
Convert impls to new syntax
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/auto_serialize.rs2
-rw-r--r--src/libsyntax/ext/base.rs4
-rw-r--r--src/libsyntax/ext/pipes.rs4
-rw-r--r--src/libsyntax/ext/pipes/ast_builder.rs4
-rw-r--r--src/libsyntax/ext/pipes/check.rs6
-rw-r--r--src/libsyntax/ext/pipes/liveness.rs3
-rw-r--r--src/libsyntax/ext/pipes/parse_proto.rs2
-rw-r--r--src/libsyntax/ext/pipes/pipec.rs26
-rw-r--r--src/libsyntax/ext/pipes/proto.rs14
-rw-r--r--src/libsyntax/ext/qquote.rs14
-rw-r--r--src/libsyntax/ext/simplext.rs2
-rw-r--r--src/libsyntax/ext/tt/earley_parser.rs2
-rw-r--r--src/libsyntax/ext/tt/macro_rules.rs2
13 files changed, 36 insertions, 49 deletions
diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs
index 934a295dfb5..c93dccda034 100644
--- a/src/libsyntax/ext/auto_serialize.rs
+++ b/src/libsyntax/ext/auto_serialize.rs
@@ -150,7 +150,7 @@ trait ext_ctxt_helpers {
     fn at(span: span, expr: @ast::expr) -> @ast::expr;
 }
 
-impl helpers of ext_ctxt_helpers for ext_ctxt {
+impl ext_ctxt: ext_ctxt_helpers {
     fn helper_path(base_path: @ast::path,
                    helper_name: ~str) -> @ast::path {
         let head = vec::init(base_path.idents);
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 0f163e73c81..484932b539e 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -144,7 +144,7 @@ fn mk_ctxt(parse_sess: parse::parse_sess,
                       cfg: ast::crate_cfg,
                       mut backtrace: expn_info,
                       mut mod_path: ~[ast::ident]};
-    impl of ext_ctxt for ctxt_repr {
+    impl ctxt_repr: ext_ctxt {
         fn codemap() -> codemap { self.parse_sess.cm }
         fn parse_sess() -> parse::parse_sess { self.parse_sess }
         fn cfg() -> ast::crate_cfg { self.cfg }
@@ -277,7 +277,7 @@ fn get_mac_body(cx: ext_ctxt, sp: span, args: ast::mac_body)
 fn tt_args_to_original_flavor(cx: ext_ctxt, sp: span, arg: ~[ast::token_tree])
     -> ast::mac_arg {
     import ast::{matcher, matcher_, match_tok, match_seq, match_nonterminal};
-    import parse::lexer::{new_tt_reader, tt_reader_as_reader, reader};
+    import parse::lexer::{new_tt_reader, reader};
     import tt::earley_parser::{parse_or_else, matched_seq,
                                matched_nonterminal};
 
diff --git a/src/libsyntax/ext/pipes.rs b/src/libsyntax/ext/pipes.rs
index 08562c4490f..b9ff13c9578 100644
--- a/src/libsyntax/ext/pipes.rs
+++ b/src/libsyntax/ext/pipes.rs
@@ -36,15 +36,13 @@ FIXME (#3072) - This is still incomplete.
 import codemap::span;
 import ext::base::ext_ctxt;
 import ast::tt_delim;
-import parse::lexer::{new_tt_reader, reader, tt_reader_as_reader};
+import parse::lexer::{new_tt_reader, reader};
 import parse::parser::{parser, SOURCE_FILE};
 import parse::common::parser_common;
 
 import pipes::parse_proto::proto_parser;
 
-import pipes::pipec::compile;
 import pipes::proto::{visit, protocol};
-import pipes::check::proto_check;
 
 fn expand_proto(cx: ext_ctxt, _sp: span, id: ast::ident,
                 tt: ~[ast::token_tree]) -> base::mac_result
diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs
index 716fe62a61f..d2ef304a1f0 100644
--- a/src/libsyntax/ext/pipes/ast_builder.rs
+++ b/src/libsyntax/ext/pipes/ast_builder.rs
@@ -36,7 +36,7 @@ trait append_types {
     fn add_tys(+tys: ~[@ast::ty]) -> @ast::path;
 }
 
-impl methods of append_types for @ast::path {
+impl @ast::path: append_types {
     fn add_ty(ty: @ast::ty) -> @ast::path {
         @{types: vec::append_one(self.types, ty)
           with *self}
@@ -89,7 +89,7 @@ trait ext_ctxt_ast_builder {
     fn ty_option(ty: @ast::ty) -> @ast::ty;
 }
 
-impl ast_builder of ext_ctxt_ast_builder for ext_ctxt {
+impl ext_ctxt: ext_ctxt_ast_builder {
     fn ty_option(ty: @ast::ty) -> @ast::ty {
         self.ty_path_ast_builder(path(@~"option", self.empty_span())
                                  .add_ty(ty))
diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs
index 8595a991e24..e286b4f76be 100644
--- a/src/libsyntax/ext/pipes/check.rs
+++ b/src/libsyntax/ext/pipes/check.rs
@@ -19,16 +19,14 @@ that.
 
 */
 
-import dvec::extensions;
-
 import ext::base::ext_ctxt;
 
 import ast::{ident};
 
-import proto::{state, protocol, next_state, methods};
+import proto::{state, protocol, next_state};
 import ast_builder::empty_span;
 
-impl proto_check of proto::visitor<(), (), ()>  for ext_ctxt {
+impl ext_ctxt: proto::visitor<(), (), ()>  {
     fn visit_proto(_proto: protocol,
                    _states: &[()]) { }
 
diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs
index 87179accefa..17e569552a7 100644
--- a/src/libsyntax/ext/pipes/liveness.rs
+++ b/src/libsyntax/ext/pipes/liveness.rs
@@ -27,11 +27,8 @@ updating the states using rule (2) until there are no changes.
 
 */
 
-import dvec::extensions;
-
 import std::bitv::{bitv};
 
-import proto::methods;
 import ast_builder::empty_span;
 
 fn analyze(proto: protocol, _cx: ext_ctxt) {
diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs
index aa553d8ae53..84180ff3797 100644
--- a/src/libsyntax/ext/pipes/parse_proto.rs
+++ b/src/libsyntax/ext/pipes/parse_proto.rs
@@ -11,7 +11,7 @@ trait proto_parser {
     fn parse_state(proto: protocol);
 }
 
-impl proto_parser of proto_parser for parser {
+impl parser: proto_parser {
     fn parse_proto(id: ident) -> protocol {
         let proto = protocol(id, self.span);
 
diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs
index b4db8a6a72a..a835cbb27a4 100644
--- a/src/libsyntax/ext/pipes/pipec.rs
+++ b/src/libsyntax/ext/pipes/pipec.rs
@@ -3,9 +3,6 @@
 import to_str::to_str;
 
 import dvec::dvec;
-import dvec::extensions;
-
-import tuple::extensions;
 
 import ast::ident;
 import util::interner;
@@ -15,11 +12,8 @@ import ext::base::{mk_ctxt, ext_ctxt};
 import parse;
 import parse::*;
 import proto::*;
-import ast::methods;
 
 import ast_builder::append_types;
-import ast_builder::ast_builder;
-import ast_builder::methods;
 import ast_builder::path;
 
 // Transitional reexports so qquote can find the paths it is looking for
@@ -44,7 +38,7 @@ trait gen_init {
     fn compile(cx: ext_ctxt) -> @ast::item;
 }
 
-impl compile of gen_send for message {
+impl message: gen_send {
     fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item {
         debug!{"pipec: gen_send"};
         match self {
@@ -199,7 +193,7 @@ impl compile of gen_send for message {
     }
 }
 
-impl compile of to_type_decls for state {
+impl state: to_type_decls {
     fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item] {
         debug!{"pipec: to_type_decls"};
         // This compiles into two different type declarations. Say the
@@ -283,7 +277,7 @@ impl compile of to_type_decls for state {
     }
 }
 
-impl compile of gen_init for protocol {
+impl protocol: gen_init {
     fn gen_init(cx: ext_ctxt) -> @ast::item {
         let ext_cx = cx;
 
@@ -425,37 +419,37 @@ trait to_source {
     fn to_source() -> ~str;
 }
 
-impl of to_source for @ast::item {
+impl @ast::item: to_source {
     fn to_source() -> ~str {
         item_to_str(self)
     }
 }
 
-impl of to_source for ~[@ast::item] {
+impl ~[@ast::item]: to_source {
     fn to_source() -> ~str {
         str::connect(self.map(|i| i.to_source()), ~"\n\n")
     }
 }
 
-impl of to_source for @ast::ty {
+impl @ast::ty: to_source {
     fn to_source() -> ~str {
         ty_to_str(self)
     }
 }
 
-impl of to_source for ~[@ast::ty] {
+impl ~[@ast::ty]: to_source {
     fn to_source() -> ~str {
         str::connect(self.map(|i| i.to_source()), ~", ")
     }
 }
 
-impl of to_source for ~[ast::ty_param] {
+impl ~[ast::ty_param]: to_source {
     fn to_source() -> ~str {
         pprust::typarams_to_str(self)
     }
 }
 
-impl of to_source for @ast::expr {
+impl @ast::expr: to_source {
     fn to_source() -> ~str {
         pprust::expr_to_str(self)
     }
@@ -467,7 +461,7 @@ trait ext_ctxt_parse_utils {
     fn parse_stmt(s: ~str) -> @ast::stmt;
 }
 
-impl parse_utils of ext_ctxt_parse_utils for ext_ctxt {
+impl ext_ctxt: ext_ctxt_parse_utils {
     fn parse_item(s: ~str) -> @ast::item {
         let res = parse::parse_item_from_source_str(
             ~"***protocol expansion***",
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 5769125225e..8409135db6b 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -1,15 +1,15 @@
 import to_str::to_str;
-import dvec::{dvec, extensions};
+import dvec::dvec;
 
 import ast::{ident};
 
-import ast_builder::{path, methods, ast_builder, append_types};
+import ast_builder::{path, append_types};
 
 enum direction {
     send, recv
 }
 
-impl of to_str for direction {
+impl direction: to_str {
     fn to_str() -> ~str {
         match self {
           send => ~"send",
@@ -18,7 +18,7 @@ impl of to_str for direction {
     }
 }
 
-impl methods for direction {
+impl direction {
     fn reverse() -> direction {
         match self {
           send => recv,
@@ -34,7 +34,7 @@ enum message {
     message(ident, span, ~[@ast::ty], state, next_state)
 }
 
-impl methods for message {
+impl message {
     fn name() -> ident {
         match self {
           message(id, _, _, _, _) => id
@@ -67,7 +67,7 @@ enum state {
     }),
 }
 
-impl methods for state {
+impl state {
     fn add_message(name: ident, span: span,
                    +data: ~[@ast::ty], next: next_state) {
         self.messages.push(message(name, span, data, self,
@@ -161,7 +161,7 @@ class protocol_ {
     }
 }
 
-impl methods for protocol {
+impl protocol {
     fn add_state(name: ident, dir: direction) -> state {
         self.add_state_poly(name, dir, ~[])
     }
diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs
index 8d219ec4395..c5af28bc0b3 100644
--- a/src/libsyntax/ext/qquote.rs
+++ b/src/libsyntax/ext/qquote.rs
@@ -2,7 +2,7 @@ import ast::{crate, expr_, mac_invoc,
                      mac_aq, mac_var};
 import parse::parser;
 import parse::parser::parse_from_source_str;
-import dvec::{dvec, extensions};
+import dvec::dvec;
 
 import fold::*;
 import visit::*;
@@ -34,7 +34,7 @@ trait qq_helper {
     fn get_fold_fn() -> ~str;
 }
 
-impl of qq_helper for @ast::crate {
+impl @ast::crate: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_crate(*self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {fail}
@@ -44,7 +44,7 @@ impl of qq_helper for @ast::crate {
     }
     fn get_fold_fn() -> ~str {~"fold_crate"}
 }
-impl of qq_helper for @ast::expr {
+impl @ast::expr: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_expr(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {
@@ -59,7 +59,7 @@ impl of qq_helper for @ast::expr {
     }
     fn get_fold_fn() -> ~str {~"fold_expr"}
 }
-impl of qq_helper for @ast::ty {
+impl @ast::ty: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_ty(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {
@@ -74,7 +74,7 @@ impl of qq_helper for @ast::ty {
     }
     fn get_fold_fn() -> ~str {~"fold_ty"}
 }
-impl of qq_helper for @ast::item {
+impl @ast::item: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_item(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {fail}
@@ -84,7 +84,7 @@ impl of qq_helper for @ast::item {
     }
     fn get_fold_fn() -> ~str {~"fold_item"}
 }
-impl of qq_helper for @ast::stmt {
+impl @ast::stmt: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_stmt(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {fail}
@@ -94,7 +94,7 @@ impl of qq_helper for @ast::stmt {
     }
     fn get_fold_fn() -> ~str {~"fold_stmt"}
 }
-impl of qq_helper for @ast::pat {
+impl @ast::pat: qq_helper {
     fn span() -> span {self.span}
     fn visit(cx: aq_ctxt, v: vt<aq_ctxt>) {visit_pat(self, cx, v);}
     fn extract_mac() -> option<ast::mac_> {fail}
diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs
index 426fea346b9..98289152d33 100644
--- a/src/libsyntax/ext/simplext.rs
+++ b/src/libsyntax/ext/simplext.rs
@@ -1,6 +1,6 @@
 import codemap::span;
 import std::map::{hashmap, str_hash, box_str_hash};
-import dvec::{dvec, extensions};
+import dvec::dvec;
 
 import base::*;
 
diff --git a/src/libsyntax/ext/tt/earley_parser.rs b/src/libsyntax/ext/tt/earley_parser.rs
index d84eb3ec488..a0717591b49 100644
--- a/src/libsyntax/ext/tt/earley_parser.rs
+++ b/src/libsyntax/ext/tt/earley_parser.rs
@@ -7,7 +7,7 @@ import parse::parser::{parser,SOURCE_FILE};
 //import parse::common::parser_common;
 import parse::common::*; //resolve bug?
 import parse::parse_sess;
-import dvec::{dvec, extensions};
+import dvec::dvec;
 import ast::{matcher, match_tok, match_seq, match_nonterminal, ident};
 import ast_util::mk_sp;
 import std::map::{hashmap, box_str_hash};
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index a870928d50b..557b11c5d95 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -2,7 +2,7 @@ import base::{ext_ctxt, mac_result, mr_expr, mr_def, expr_tt};
 import codemap::span;
 import ast::{ident, matcher_, matcher, match_tok,
              match_nonterminal, match_seq, tt_delim};
-import parse::lexer::{new_tt_reader, tt_reader_as_reader, reader};
+import parse::lexer::{new_tt_reader, reader};
 import parse::token::{FAT_ARROW, SEMI, LBRACE, RBRACE, nt_matchers, nt_tt};
 import parse::parser::{parser, SOURCE_FILE};
 import earley_parser::{parse, parse_or_else, success, failure, named_match,