libsyntax: Remove pub impl from the language

This commit is contained in:
Patrick Walton 2013-06-03 16:56:35 -07:00
parent 9873f67e94
commit 16086ecff7
6 changed files with 25 additions and 27 deletions

View File

@ -57,7 +57,7 @@ pub struct Terminal {
}
#[cfg(not(target_os = "win32"))]
pub impl Terminal {
impl Terminal {
pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
let term = os::getenv("TERM");
if term.is_none() {
@ -81,7 +81,7 @@ pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
return Ok(Terminal {out: out, ti: inf, color_supported: cs});
}
fn fg(&self, color: u8) {
pub fn fg(&self, color: u8) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
[Number(color as int)], [], []);
@ -92,7 +92,7 @@ fn fg(&self, color: u8) {
}
}
}
fn bg(&self, color: u8) {
pub fn bg(&self, color: u8) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
[Number(color as int)], [], []);
@ -103,7 +103,7 @@ fn bg(&self, color: u8) {
}
}
}
fn reset(&self) {
pub fn reset(&self) {
if self.color_supported {
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []);
if s.is_ok() {
@ -116,17 +116,17 @@ fn reset(&self) {
}
#[cfg(target_os = "win32")]
pub impl Terminal {
impl Terminal {
pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
return Ok(Terminal {out: out, color_supported: false});
}
fn fg(&self, color: u8) {
pub fn fg(&self, color: u8) {
}
fn bg(&self, color: u8) {
pub fn bg(&self, color: u8) {
}
fn reset(&self) {
pub fn reset(&self) {
}
}

View File

@ -35,8 +35,8 @@ pub struct PkgId {
version: Version
}
pub impl PkgId {
fn new(s: &str) -> PkgId {
impl PkgId {
pub fn new(s: &str) -> PkgId {
use conditions::bad_pkg_id::cond;
let p = Path(s);
@ -57,13 +57,13 @@ fn new(s: &str) -> PkgId {
}
}
fn hash(&self) -> ~str {
pub fn hash(&self) -> ~str {
fmt!("%s-%s-%s", self.remote_path.to_str(),
hash(self.remote_path.to_str() + self.version.to_str()),
self.version.to_str())
}
fn short_name_with_version(&self) -> ~str {
pub fn short_name_with_version(&self) -> ~str {
fmt!("%s-%s", self.short_name, self.version.to_str())
}
}

View File

@ -440,8 +440,8 @@ pub struct expr {
span: span,
}
pub impl expr {
fn get_callee_id(&self) -> Option<node_id> {
impl expr {
pub fn get_callee_id(&self) -> Option<node_id> {
match self.node {
expr_method_call(callee_id, _, _, _, _, _) |
expr_index(callee_id, _, _) |

View File

@ -49,7 +49,7 @@ pub enum ObsoleteSyntax {
ObsoleteTraitBoundSeparator,
ObsoleteMutOwnedPointer,
ObsoleteMutVector,
ObsoleteTraitImplVisibility,
ObsoleteImplVisibility,
ObsoleteRecordType,
ObsoleteRecordPattern,
ObsoletePostFnTySigil,
@ -158,11 +158,10 @@ pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
in a mutable location, like a mutable local variable or an \
`@mut` box"
),
ObsoleteTraitImplVisibility => (
"visibility-qualified trait implementation",
"`pub` or `priv` is meaningless for trait implementations, \
because the `impl...for...` form defines overloads for \
methods that already exist; remove the `pub` or `priv`"
ObsoleteImplVisibility => (
"visibility-qualified implementation",
"`pub` or `priv` goes on individual functions; remove the \
`pub` or `priv`"
),
ObsoleteRecordType => (
"structural record type",

View File

@ -76,7 +76,7 @@
use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility};
use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
use parse::obsolete::{ObsoletePostFnTySigil};
use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
@ -3305,10 +3305,9 @@ fn parse_item_impl(&self, visibility: ast::visibility) -> item_info {
None
};
// Do not allow visibility to be specified in `impl...for...`. It is
// meaningless.
if opt_trait.is_some() && visibility != ast::inherited {
self.obsolete(*self.span, ObsoleteTraitImplVisibility);
// Do not allow visibility to be specified.
if visibility != ast::inherited {
self.obsolete(*self.span, ObsoleteImplVisibility);
}
let mut meths = ~[];

View File

@ -34,7 +34,7 @@ pub struct Boz {
unused_str: ~str
}
pub impl Boz {
impl Boz {
pub fn boz(i: int) -> bool {
i > 0
}
@ -45,7 +45,7 @@ pub enum Bort {
Bort2
}
pub impl Bort {
impl Bort {
pub fn bort() -> ~str {
~"bort()"
}