From 95b892c8a723ad88e868e3914c3d29a585008ac2 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 29 Jan 2013 13:54:06 -0800 Subject: libsyntax: De-export a lot of libsyntax. rs=deƫxporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libsyntax/ext/pipes/ast_builder.rs | 11 +++++------ src/libsyntax/ext/pipes/check.rs | 3 ++- src/libsyntax/ext/pipes/liveness.rs | 3 ++- src/libsyntax/ext/pipes/mod.rs | 6 ------ src/libsyntax/ext/pipes/parse_proto.rs | 4 ++-- src/libsyntax/ext/pipes/pipec.rs | 12 ++++++------ src/libsyntax/ext/pipes/proto.rs | 35 +++++++++++++++++----------------- src/libsyntax/ext/tt/macro_parser.rs | 8 +++++--- 8 files changed, 40 insertions(+), 42 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/pipes/ast_builder.rs b/src/libsyntax/ext/pipes/ast_builder.rs index 0433aab51fc..a85898390a4 100644 --- a/src/libsyntax/ext/pipes/ast_builder.rs +++ b/src/libsyntax/ext/pipes/ast_builder.rs @@ -28,12 +28,11 @@ use core::vec; // Transitional reexports so qquote can find the paths it is looking for mod syntax { - #[legacy_exports]; pub use ext; pub use parse; } -fn path(ids: ~[ident], span: span) -> @ast::path { +pub fn path(ids: ~[ident], span: span) -> @ast::path { @ast::path { span: span, global: false, idents: ids, @@ -41,7 +40,7 @@ fn path(ids: ~[ident], span: span) -> @ast::path { types: ~[] } } -fn path_global(ids: ~[ident], span: span) -> @ast::path { +pub fn path_global(ids: ~[ident], span: span) -> @ast::path { @ast::path { span: span, global: true, idents: ids, @@ -49,12 +48,12 @@ fn path_global(ids: ~[ident], span: span) -> @ast::path { types: ~[] } } -trait append_types { +pub trait append_types { fn add_ty(ty: @ast::Ty) -> @ast::path; fn add_tys(+tys: ~[@ast::Ty]) -> @ast::path; } -impl @ast::path: append_types { +pub impl @ast::path: append_types { fn add_ty(ty: @ast::Ty) -> @ast::path { @ast::path { types: vec::append_one(self.types, ty), .. *self} @@ -113,7 +112,7 @@ pub trait ext_ctxt_ast_builder { fn strip_bounds(bounds: &[ast::ty_param]) -> ~[ast::ty_param]; } -impl ext_ctxt: ext_ctxt_ast_builder { +pub impl ext_ctxt: ext_ctxt_ast_builder { fn ty_option(ty: @ast::Ty) -> @ast::Ty { self.ty_path_ast_builder(path_global(~[ self.ident_of(~"core"), diff --git a/src/libsyntax/ext/pipes/check.rs b/src/libsyntax/ext/pipes/check.rs index 95d3308dd2f..cde6a581dce 100644 --- a/src/libsyntax/ext/pipes/check.rs +++ b/src/libsyntax/ext/pipes/check.rs @@ -37,7 +37,7 @@ use ext::base::ext_ctxt; use ext::pipes::proto::{state, protocol, next_state}; use ext::pipes::proto; -impl ext_ctxt: proto::visitor<(), (), ()> { +pub impl ext_ctxt: proto::visitor<(), (), ()> { fn visit_proto(_proto: protocol, _states: &[()]) { } @@ -82,3 +82,4 @@ impl ext_ctxt: proto::visitor<(), (), ()> { } } } + diff --git a/src/libsyntax/ext/pipes/liveness.rs b/src/libsyntax/ext/pipes/liveness.rs index 01e99594083..2e73002a890 100644 --- a/src/libsyntax/ext/pipes/liveness.rs +++ b/src/libsyntax/ext/pipes/liveness.rs @@ -45,7 +45,7 @@ use ext::pipes::protocol; use core::str; use std::bitv::{Bitv}; -fn analyze(proto: protocol, _cx: ext_ctxt) { +pub fn analyze(proto: protocol, _cx: ext_ctxt) { debug!("initializing colive analysis"); let num_states = proto.num_states(); let colive = do (copy proto.states).map_to_vec |state| { @@ -103,3 +103,4 @@ fn analyze(proto: protocol, _cx: ext_ctxt) { proto.bounded = Some(true); } } + diff --git a/src/libsyntax/ext/pipes/mod.rs b/src/libsyntax/ext/pipes/mod.rs index f91ec1ea48f..c84ab54af2b 100644 --- a/src/libsyntax/ext/pipes/mod.rs +++ b/src/libsyntax/ext/pipes/mod.rs @@ -56,17 +56,11 @@ use parse::parser::Parser; use core::option::None; -#[legacy_exports] mod ast_builder; -#[legacy_exports] mod parse_proto; -#[legacy_exports] mod pipec; -#[legacy_exports] mod proto; -#[legacy_exports] mod check; -#[legacy_exports] mod liveness; diff --git a/src/libsyntax/ext/pipes/parse_proto.rs b/src/libsyntax/ext/pipes/parse_proto.rs index e87a044fa01..a74214c8758 100644 --- a/src/libsyntax/ext/pipes/parse_proto.rs +++ b/src/libsyntax/ext/pipes/parse_proto.rs @@ -16,13 +16,13 @@ use parse::token; use core::prelude::*; -trait proto_parser { +pub trait proto_parser { fn parse_proto(id: ~str) -> protocol; fn parse_state(proto: protocol); fn parse_message(state: state); } -impl parser::Parser: proto_parser { +pub impl parser::Parser: proto_parser { fn parse_proto(id: ~str) -> protocol { let proto = protocol(id, self.span); diff --git a/src/libsyntax/ext/pipes/pipec.rs b/src/libsyntax/ext/pipes/pipec.rs index e7a8cbb9891..928885cf817 100644 --- a/src/libsyntax/ext/pipes/pipec.rs +++ b/src/libsyntax/ext/pipes/pipec.rs @@ -26,12 +26,12 @@ use core::str; use core::to_str::ToStr; use core::vec; -trait gen_send { +pub trait gen_send { fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item; fn to_ty(cx: ext_ctxt) -> @ast::Ty; } -trait to_type_decls { +pub trait to_type_decls { fn to_type_decls(cx: ext_ctxt) -> ~[@ast::item]; fn to_endpoint_decls(cx: ext_ctxt, dir: direction) -> ~[@ast::item]; } @@ -45,7 +45,7 @@ pub trait gen_init { fn gen_init_bounded(ext_cx: ext_ctxt) -> @ast::expr; } -impl message: gen_send { +pub impl message: gen_send { fn gen_send(cx: ext_ctxt, try: bool) -> @ast::item { debug!("pipec: gen_send"); match self { @@ -201,7 +201,7 @@ impl message: gen_send { } } -impl state: to_type_decls { +pub 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 @@ -305,7 +305,7 @@ impl state: to_type_decls { } } -impl protocol: gen_init { +pub impl protocol: gen_init { fn gen_init(cx: ext_ctxt) -> @ast::item { let ext_cx = cx; @@ -445,4 +445,4 @@ impl protocol: gen_init { cx.item_mod(cx.ident_of(self.name), self.span, items) } - } +} diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 9d24b3db724..5c2dd82eb7f 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -19,9 +19,9 @@ use core::cmp; use core::dvec::DVec; use core::to_str::ToStr; -enum direction { send, recv } +pub enum direction { send, recv } -impl direction : cmp::Eq { +pub impl direction : cmp::Eq { pure fn eq(&self, other: &direction) -> bool { match ((*self), (*other)) { (send, send) => true, @@ -33,7 +33,7 @@ impl direction : cmp::Eq { pure fn ne(&self, other: &direction) -> bool { !(*self).eq(other) } } -impl direction: ToStr { +pub impl direction: ToStr { pure fn to_str() -> ~str { match self { send => ~"Send", @@ -42,7 +42,7 @@ impl direction: ToStr { } } -impl direction { +pub impl direction { fn reverse() -> direction { match self { send => recv, @@ -51,17 +51,17 @@ impl direction { } } -struct next_state { +pub struct next_state { state: ~str, tys: ~[@ast::Ty], } -enum message { +pub enum message { // name, span, data, current state, next state message(~str, span, ~[@ast::Ty], state, Option) } -impl message { +pub impl message { fn name() -> ~str { match self { message(ref id, _, _, _, _) => (*id) @@ -82,7 +82,7 @@ impl message { } } -enum state { +pub enum state { state_(@{ id: uint, name: ~str, @@ -95,7 +95,7 @@ enum state { }), } -impl state { +pub impl state { fn add_message(name: ~str, span: span, +data: ~[@ast::Ty], next: Option) { self.messages.push(message(name, span, data, self, @@ -132,13 +132,13 @@ impl state { } } -type protocol = @protocol_; +pub type protocol = @protocol_; -fn protocol(name: ~str, +span: span) -> protocol { +pub fn protocol(name: ~str, +span: span) -> protocol { @protocol_(name, span) } -fn protocol_(name: ~str, span: span) -> protocol_ { +pub fn protocol_(name: ~str, span: span) -> protocol_ { protocol_ { name: name, span: span, @@ -147,7 +147,7 @@ fn protocol_(name: ~str, span: span) -> protocol_ { } } -struct protocol_ { +pub struct protocol_ { name: ~str, span: span, states: DVec, @@ -155,7 +155,7 @@ struct protocol_ { mut bounded: Option, } -impl protocol_ { +pub impl protocol_ { /// Get a state. fn get_state(name: ~str) -> state { @@ -195,7 +195,7 @@ impl protocol_ { } } -impl protocol { +pub impl protocol { fn add_state_poly(name: ~str, ident: ast::ident, dir: direction, +ty_params: ~[ast::ty_param]) -> state { let messages = DVec(); @@ -216,14 +216,14 @@ impl protocol { } } -trait visitor { +pub trait visitor { fn visit_proto(proto: protocol, st: &[Tstate]) -> Tproto; fn visit_state(state: state, m: &[Tmessage]) -> Tstate; fn visit_message(name: ~str, spane: span, tys: &[@ast::Ty], this: state, next: Option) -> Tmessage; } -fn visit>( +pub fn visit>( proto: protocol, visitor: V) -> Tproto { // the copy keywords prevent recursive use of dvec @@ -236,3 +236,4 @@ fn visit>( }; visitor.visit_proto(proto, states) } + diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 2449db17c0f..a990e53c1a7 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -189,13 +189,15 @@ fn nameize(p_s: parse_sess, ms: ~[matcher], res: ~[@named_match]) fn n_rec(p_s: parse_sess, m: matcher, res: ~[@named_match], ret_val: HashMap) { match m { - spanned {node: match_tok(_), _} => (), - spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { + ast::spanned {node: match_tok(_), _} => (), + ast::spanned {node: match_seq(ref more_ms, _, _, _, _), _} => { for (*more_ms).each() |next_m| { n_rec(p_s, *next_m, res, ret_val) }; } - spanned {node: match_nonterminal(bind_name, _, idx), span: sp} => { + ast::spanned { + node: match_nonterminal(bind_name, _, idx), span: sp + } => { if ret_val.contains_key(bind_name) { p_s.span_diagnostic.span_fatal(sp, ~"Duplicated bind name: "+ *p_s.interner.get(bind_name)) -- cgit 1.4.1-3-g733a5