about summary refs log tree commit diff
path: root/src/libsyntax/ext
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-05-31 15:17:22 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-06-01 09:18:27 -0700
commit5fb254695b4db9af3d8e33577fae28ae9f7006c5 (patch)
tree33a4db59bd936a73594ca144e809b6074d6ccef3 /src/libsyntax/ext
parent1e52eede31a1df3627bfa9f43b9d06c730895c01 (diff)
downloadrust-5fb254695b4db9af3d8e33577fae28ae9f7006c5.tar.gz
rust-5fb254695b4db9af3d8e33577fae28ae9f7006c5.zip
Remove all uses of `pub impl`. rs=style
Diffstat (limited to 'src/libsyntax/ext')
-rw-r--r--src/libsyntax/ext/base.rs51
-rw-r--r--src/libsyntax/ext/deriving/ty.rs59
-rw-r--r--src/libsyntax/ext/pipes/proto.rs60
3 files changed, 99 insertions, 71 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index a9b12c16b31..5fae6ff3c18 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -219,8 +219,9 @@ pub struct ExtCtxt {
     trace_mac: @mut bool
 }
 
-pub impl ExtCtxt {
-    fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg) -> @ExtCtxt {
+impl ExtCtxt {
+    pub fn new(parse_sess: @mut parse::ParseSess, cfg: ast::crate_cfg)
+               -> @ExtCtxt {
         @ExtCtxt {
             parse_sess: parse_sess,
             cfg: cfg,
@@ -230,21 +231,21 @@ pub impl ExtCtxt {
         }
     }
 
-    fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
-    fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
-    fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
-    fn call_site(&self) -> span {
+    pub fn codemap(&self) -> @CodeMap { self.parse_sess.cm }
+    pub fn parse_sess(&self) -> @mut parse::ParseSess { self.parse_sess }
+    pub fn cfg(&self) -> ast::crate_cfg { copy self.cfg }
+    pub fn call_site(&self) -> span {
         match *self.backtrace {
             Some(@ExpandedFrom(CallInfo {call_site: cs, _})) => cs,
             None => self.bug("missing top span")
         }
     }
-    fn print_backtrace(&self) { }
-    fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
-    fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
-    fn mod_pop(&self) { self.mod_path.pop(); }
-    fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
-    fn bt_push(&self, ei: codemap::ExpnInfo) {
+    pub fn print_backtrace(&self) { }
+    pub fn backtrace(&self) -> Option<@ExpnInfo> { *self.backtrace }
+    pub fn mod_push(&self, i: ast::ident) { self.mod_path.push(i); }
+    pub fn mod_pop(&self) { self.mod_path.pop(); }
+    pub fn mod_path(&self) -> ~[ast::ident] { copy *self.mod_path }
+    pub fn bt_push(&self, ei: codemap::ExpnInfo) {
         match ei {
             ExpandedFrom(CallInfo {call_site: cs, callee: ref callee}) => {
                 *self.backtrace =
@@ -255,7 +256,7 @@ pub impl ExtCtxt {
             }
         }
     }
-    fn bt_pop(&self) {
+    pub fn bt_pop(&self) {
         match *self.backtrace {
             Some(@ExpandedFrom(
                 CallInfo {
@@ -266,43 +267,43 @@ pub impl ExtCtxt {
             _ => self.bug("tried to pop without a push")
         }
     }
-    fn span_fatal(&self, sp: span, msg: &str) -> ! {
+    pub fn span_fatal(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_fatal(sp, msg);
     }
-    fn span_err(&self, sp: span, msg: &str) {
+    pub fn span_err(&self, sp: span, msg: &str) {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_err(sp, msg);
     }
-    fn span_warn(&self, sp: span, msg: &str) {
+    pub fn span_warn(&self, sp: span, msg: &str) {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_warn(sp, msg);
     }
-    fn span_unimpl(&self, sp: span, msg: &str) -> ! {
+    pub fn span_unimpl(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_unimpl(sp, msg);
     }
-    fn span_bug(&self, sp: span, msg: &str) -> ! {
+    pub fn span_bug(&self, sp: span, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.span_bug(sp, msg);
     }
-    fn bug(&self, msg: &str) -> ! {
+    pub fn bug(&self, msg: &str) -> ! {
         self.print_backtrace();
         self.parse_sess.span_diagnostic.handler().bug(msg);
     }
-    fn next_id(&self) -> ast::node_id {
+    pub fn next_id(&self) -> ast::node_id {
         parse::next_node_id(self.parse_sess)
     }
-    fn trace_macros(&self) -> bool {
+    pub fn trace_macros(&self) -> bool {
         *self.trace_mac
     }
-    fn set_trace_macros(&self, x: bool) {
+    pub fn set_trace_macros(&self, x: bool) {
         *self.trace_mac = x
     }
-    fn str_of(&self, id: ast::ident) -> ~str {
+    pub fn str_of(&self, id: ast::ident) -> ~str {
         copy *self.parse_sess.interner.get(id)
     }
-    fn ident_of(&self, st: &str) -> ast::ident {
+    pub fn ident_of(&self, st: &str) -> ast::ident {
         self.parse_sess.interner.intern(st)
     }
 }
@@ -436,7 +437,7 @@ impl <K: Eq + Hash + IterBytes ,V: Copy> MapChain<K,V>{
     }
 
 // traits just don't work anywhere...?
-//pub impl Map<Name,SyntaxExtension> for MapChain {
+//impl Map<Name,SyntaxExtension> for MapChain {
 
     fn contains_key (&self, key: &K) -> bool {
         match *self {
diff --git a/src/libsyntax/ext/deriving/ty.rs b/src/libsyntax/ext/deriving/ty.rs
index f8f7dc8db5f..3b39cb691a6 100644
--- a/src/libsyntax/ext/deriving/ty.rs
+++ b/src/libsyntax/ext/deriving/ty.rs
@@ -38,15 +38,18 @@ pub struct Path<'self> {
     global: bool
 }
 
-pub impl<'self> Path<'self> {
-    fn new<'r>(path: ~[&'r str]) -> Path<'r> {
+impl<'self> Path<'self> {
+    pub fn new<'r>(path: ~[&'r str]) -> Path<'r> {
         Path::new_(path, None, ~[], true)
     }
-    fn new_local<'r>(path: &'r str) -> Path<'r> {
+    pub fn new_local<'r>(path: &'r str) -> Path<'r> {
         Path::new_(~[ path ], None, ~[], false)
     }
-    fn new_<'r>(path: ~[&'r str], lifetime: Option<&'r str>, params: ~[~Ty<'r>], global: bool)
-        -> Path<'r> {
+    pub fn new_<'r>(path: ~[&'r str],
+                    lifetime: Option<&'r str>,
+                    params: ~[~Ty<'r>],
+                    global: bool)
+                    -> Path<'r> {
         Path {
             path: path,
             lifetime: lifetime,
@@ -55,13 +58,21 @@ pub impl<'self> Path<'self> {
         }
     }
 
-    fn to_ty(&self, cx: @ExtCtxt, span: span,
-             self_ty: ident, self_generics: &Generics) -> @ast::Ty {
+    pub fn to_ty(&self,
+                 cx: @ExtCtxt,
+                 span: span,
+                 self_ty: ident,
+                 self_generics: &Generics)
+                 -> @ast::Ty {
         cx.ty_path(self.to_path(cx, span,
                                 self_ty, self_generics))
     }
-    fn to_path(&self, cx: @ExtCtxt, span: span,
-               self_ty: ident, self_generics: &Generics) -> @ast::Path {
+    pub fn to_path(&self,
+                   cx: @ExtCtxt,
+                   span: span,
+                   self_ty: ident,
+                   self_generics: &Generics)
+                   -> @ast::Path {
         let idents = self.path.map(|s| cx.ident_of(*s) );
         let lt = mk_lifetime(cx, span, &self.lifetime);
         let tys = self.params.map(|t| t.to_ty(cx, span, self_ty, self_generics));
@@ -108,9 +119,13 @@ fn mk_lifetime(cx: @ExtCtxt, span: span, lt: &Option<&str>) -> Option<@ast::Life
     }
 }
 
-pub impl<'self> Ty<'self> {
-    fn to_ty(&self, cx: @ExtCtxt, span: span,
-             self_ty: ident, self_generics: &Generics) -> @ast::Ty {
+impl<'self> Ty<'self> {
+    pub fn to_ty(&self,
+                 cx: @ExtCtxt,
+                 span: span,
+                 self_ty: ident,
+                 self_generics: &Generics)
+                 -> @ast::Ty {
         match *self {
             Ptr(ref ty, ref ptr) => {
                 let raw_ty = ty.to_ty(cx, span, self_ty, self_generics);
@@ -143,8 +158,12 @@ pub impl<'self> Ty<'self> {
         }
     }
 
-    fn to_path(&self, cx: @ExtCtxt, span: span,
-               self_ty: ident, self_generics: &Generics) -> @ast::Path {
+    pub fn to_path(&self,
+                   cx: @ExtCtxt,
+                   span: span,
+                   self_ty: ident,
+                   self_generics: &Generics)
+                   -> @ast::Path {
         match *self {
             Self => {
                 let self_params = do self_generics.ty_params.map |ty_param| {
@@ -192,14 +211,18 @@ pub struct LifetimeBounds<'self> {
     bounds: ~[(&'self str, ~[Path<'self>])]
 }
 
-pub impl<'self> LifetimeBounds<'self> {
-    fn empty() -> LifetimeBounds<'static> {
+impl<'self> LifetimeBounds<'self> {
+    pub fn empty() -> LifetimeBounds<'static> {
         LifetimeBounds {
             lifetimes: ~[], bounds: ~[]
         }
     }
-    fn to_generics(&self, cx: @ExtCtxt, span: span,
-                   self_ty: ident, self_generics: &Generics) -> Generics {
+    pub fn to_generics(&self,
+                       cx: @ExtCtxt,
+                       span: span,
+                       self_ty: ident,
+                       self_generics: &Generics)
+                       -> Generics {
         let lifetimes = do self.lifetimes.map |lt| {
             cx.lifetime(span, cx.ident_of(*lt))
         };
diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs
index 80e4520b094..0eb0f5c6159 100644
--- a/src/libsyntax/ext/pipes/proto.rs
+++ b/src/libsyntax/ext/pipes/proto.rs
@@ -28,8 +28,8 @@ impl ToStr for direction {
     }
 }
 
-pub impl direction {
-    fn reverse(&self) -> direction {
+impl direction {
+    pub fn reverse(&self) -> direction {
         match *self {
           send => recv,
           recv => send
@@ -45,21 +45,21 @@ pub struct next_state {
 // name, span, data, current state, next state
 pub struct message(~str, span, ~[@ast::Ty], state, Option<next_state>);
 
-pub impl message {
-    fn name(&mut self) -> ~str {
+impl message {
+    pub fn name(&mut self) -> ~str {
         match *self {
           message(ref id, _, _, _, _) => copy *id
         }
     }
 
-    fn span(&mut self) -> span {
+    pub fn span(&mut self) -> span {
         match *self {
           message(_, span, _, _, _) => span
         }
     }
 
     /// Return the type parameters actually used by this message
-    fn get_generics(&self) -> ast::Generics {
+    pub fn get_generics(&self) -> ast::Generics {
         match *self {
           message(_, _, _, this, _) => copy this.generics
         }
@@ -79,23 +79,26 @@ pub struct state_ {
     proto: protocol
 }
 
-pub impl state_ {
-    fn add_message(@self, name: ~str, span: span,
-                   data: ~[@ast::Ty], next: Option<next_state>) {
+impl state_ {
+    pub fn add_message(@self,
+                       name: ~str,
+                       span: span,
+                       data: ~[@ast::Ty],
+                       next: Option<next_state>) {
         self.messages.push(message(name, span, data, self,
                                    next));
     }
 
-    fn filename(&self) -> ~str {
+    pub fn filename(&self) -> ~str {
         self.proto.filename()
     }
 
-    fn data_name(&self) -> ast::ident {
+    pub fn data_name(&self) -> ast::ident {
         self.ident
     }
 
     /// Returns the type that is used for the messages.
-    fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
+    pub fn to_ty(&self, cx: @ExtCtxt) -> @ast::Ty {
         cx.ty_path
             (path(~[cx.ident_of(self.name)],self.span).add_tys(
                 cx.ty_vars(&self.generics.ty_params)))
@@ -103,7 +106,7 @@ pub impl state_ {
 
     /// Iterate over the states that can be reached in one message
     /// from this state.
-    fn reachable(&self, f: &fn(state) -> bool) -> bool {
+    pub fn reachable(&self, f: &fn(state) -> bool) -> bool {
         for self.messages.each |m| {
             match *m {
               message(_, _, _, _, Some(next_state { state: ref id, _ })) => {
@@ -140,28 +143,28 @@ pub struct protocol_ {
     bounded: Option<bool>,
 }
 
-pub impl protocol_ {
+impl protocol_ {
     /// Get a state.
-    fn get_state(&self, name: &str) -> state {
+    pub fn get_state(&self, name: &str) -> state {
         self.states.find(|i| name == i.name).get()
     }
 
-    fn get_state_by_id(&self, id: uint) -> state { self.states[id] }
+    pub fn get_state_by_id(&self, id: uint) -> state { self.states[id] }
 
-    fn has_state(&self, name: &str) -> bool {
+    pub fn has_state(&self, name: &str) -> bool {
         self.states.find(|i| name == i.name).is_some()
     }
 
-    fn filename(&self) -> ~str {
+    pub fn filename(&self) -> ~str {
         ~"proto://" + self.name
     }
 
-    fn num_states(&self) -> uint {
+    pub fn num_states(&self) -> uint {
         let states = &mut *self.states;
         states.len()
     }
 
-    fn has_ty_params(&self) -> bool {
+    pub fn has_ty_params(&self) -> bool {
         for self.states.each |s| {
             if s.generics.ty_params.len() > 0 {
                 return true;
@@ -169,19 +172,20 @@ pub impl protocol_ {
         }
         false
     }
-    fn is_bounded(&self) -> bool {
+
+    pub fn is_bounded(&self) -> bool {
         let bounded = self.bounded.get();
         bounded
     }
 }
 
-pub impl protocol_ {
-    fn add_state_poly(@mut self,
-                      name: ~str,
-                      ident: ast::ident,
-                      dir: direction,
-                      generics: ast::Generics)
-                   -> state {
+impl protocol_ {
+    pub fn add_state_poly(@mut self,
+                          name: ~str,
+                          ident: ast::ident,
+                          dir: direction,
+                          generics: ast::Generics)
+                          -> state {
         let messages = @mut ~[];
         let states = &mut *self.states;