Remove 'implements' keyword in favour of :, part of #2301.

This commit is contained in:
Graydon Hoare 2012-06-22 18:19:35 -07:00
parent 3ed8561dea
commit f60cdf27e7
17 changed files with 21 additions and 20 deletions

View File

@ -1979,7 +1979,7 @@ class parser {
let rp = self.parse_region_param();
let ty_params = self.parse_ty_params();
let class_path = self.ident_to_path_tys(class_name, rp, ty_params);
let ifaces : [@iface_ref] = if self.eat_keyword("implements")
let ifaces : [@iface_ref] = if self.eat(token::COLON)
{ self.parse_iface_ref_list() }
else { [] };
self.expect(token::LBRACE);

View File

@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> {
let keys = [
"as",
"else",
"implements",
"move",
"of",
"priv", "pub",

View File

@ -527,9 +527,11 @@ fn print_item(s: ps, &&item: @ast::item) {
word_nbsp(s, *item.ident);
print_region_param(s, rp);
print_type_params(s, tps);
word_space(s, "implements");
commasep(s, inconsistent, ifaces, {|s, p|
print_path(s, p.path, false)});
if vec::len(ifaces) != 0u {
word_space(s, ":");
commasep(s, inconsistent, ifaces, {|s, p|
print_path(s, p.path, false)});
}
bopen(s);
hardbreak_if_not_bol(s);
maybe_print_comment(s, ctor.span.lo);

View File

@ -3,7 +3,7 @@ import to_str::to_str;
mod kitty {
class cat implements to_str {
class cat : to_str {
priv {
let mut meows : uint;
fn meow() {

View File

@ -3,7 +3,7 @@ iface noisy {
fn speak();
}
class cat implements noisy {
class cat : noisy {
priv {
let mut meows : uint;
fn meow() {

View File

@ -1,5 +1,5 @@
// error-pattern:unresolved typename: nonexistent
class cat implements nonexistent {
class cat : nonexistent {
let meows: uint;
new(in_x : uint) { self.meows = in_x; }
}

View File

@ -1,4 +1,4 @@
class cat implements int { //! ERROR can only implement interface types
class cat : int { //! ERROR can only implement interface types
let meows: uint;
new(in_x : uint) { self.meows = in_x; }
}

View File

@ -3,7 +3,7 @@ iface animal {
fn eat();
}
class cat implements animal {
class cat : animal {
let meows: uint;
new(in_x : uint) { self.meows = in_x; }
}

View File

@ -1,7 +1,7 @@
import to_str::*;
import to_str::to_str;
class cat implements to_str {
class cat : to_str {
priv {
let mut meows : uint;
fn meow() {

View File

@ -2,7 +2,7 @@ iface noisy {
fn speak() -> int;
}
class dog implements noisy {
class dog : noisy {
priv {
let barks : @mut uint;
fn bark() -> int {
@ -26,7 +26,7 @@ class dog implements noisy {
fn speak() -> int { self.bark() }
}
class cat implements noisy {
class cat : noisy {
priv {
let meows : @mut uint;
fn meow() -> uint {

View File

@ -2,7 +2,7 @@ iface noisy {
fn speak();
}
class cat implements noisy {
class cat : noisy {
priv {
let mut meows : uint;
fn meow() {

View File

@ -2,7 +2,7 @@ use std;
import std::map::{map, hashmap, int_hash};
class keys<K: copy, V: copy, M: copy map<K,V>>
implements iter::base_iter<K> {
: iter::base_iter<K> {
let map: M;

View File

@ -2,7 +2,7 @@
use std;
import std::map::*;
class cat implements map<int, bool> {
class cat : map<int, bool> {
priv {
// Yes, you can have negative meows
let mut meows : int;

View File

@ -7,7 +7,7 @@ enum cat_type { tuxedo, tabby, tortoiseshell }
// for any int value that's less than the meows field
// ok: T should be in scope when resolving the iface ref for map
class cat<T: copy> implements map<int, T> {
class cat<T: copy> : map<int, T> {
priv {
// Yes, you can have negative meows
let mut meows : int;

View File

@ -3,7 +3,7 @@
use cci_class_iface;
import cci_class_iface::animals::*;
class cat implements noisy {
class cat : noisy {
priv {
let mut meows : uint;
fn meow() {

View File

@ -2,7 +2,7 @@ iface noisy {
fn speak();
}
class cat implements noisy {
class cat : noisy {
priv {
let mut meows : uint;
fn meow() {

View File

@ -24,7 +24,7 @@ fn vec_includes<T>(xs: [T], x: T) -> bool {
}
// vtables other than the 1st one don't seem to work
class cat implements noisy, scratchy, bitey {
class cat : noisy, scratchy, bitey {
priv {
let meows : @mut uint;
let scratched : dvec<furniture>;