mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 11:33:04 +00:00
Remove 'implements' keyword in favour of :, part of #2301.
This commit is contained in:
parent
3ed8561dea
commit
f60cdf27e7
@ -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);
|
||||
|
@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> {
|
||||
let keys = [
|
||||
"as",
|
||||
"else",
|
||||
"implements",
|
||||
"move",
|
||||
"of",
|
||||
"priv", "pub",
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -3,7 +3,7 @@ iface noisy {
|
||||
fn speak();
|
||||
}
|
||||
|
||||
class cat implements noisy {
|
||||
class cat : noisy {
|
||||
priv {
|
||||
let mut meows : uint;
|
||||
fn meow() {
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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; }
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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 {
|
||||
|
@ -2,7 +2,7 @@ iface noisy {
|
||||
fn speak();
|
||||
}
|
||||
|
||||
class cat implements noisy {
|
||||
class cat : noisy {
|
||||
priv {
|
||||
let mut meows : uint;
|
||||
fn meow() {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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() {
|
||||
|
@ -2,7 +2,7 @@ iface noisy {
|
||||
fn speak();
|
||||
}
|
||||
|
||||
class cat implements noisy {
|
||||
class cat : noisy {
|
||||
priv {
|
||||
let mut meows : uint;
|
||||
fn meow() {
|
||||
|
@ -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>;
|
||||
|
Loading…
Reference in New Issue
Block a user