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 rp = self.parse_region_param();
|
||||||
let ty_params = self.parse_ty_params();
|
let ty_params = self.parse_ty_params();
|
||||||
let class_path = self.ident_to_path_tys(class_name, rp, 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() }
|
{ self.parse_iface_ref_list() }
|
||||||
else { [] };
|
else { [] };
|
||||||
self.expect(token::LBRACE);
|
self.expect(token::LBRACE);
|
||||||
|
@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> {
|
|||||||
let keys = [
|
let keys = [
|
||||||
"as",
|
"as",
|
||||||
"else",
|
"else",
|
||||||
"implements",
|
|
||||||
"move",
|
"move",
|
||||||
"of",
|
"of",
|
||||||
"priv", "pub",
|
"priv", "pub",
|
||||||
|
@ -527,9 +527,11 @@ fn print_item(s: ps, &&item: @ast::item) {
|
|||||||
word_nbsp(s, *item.ident);
|
word_nbsp(s, *item.ident);
|
||||||
print_region_param(s, rp);
|
print_region_param(s, rp);
|
||||||
print_type_params(s, tps);
|
print_type_params(s, tps);
|
||||||
word_space(s, "implements");
|
if vec::len(ifaces) != 0u {
|
||||||
commasep(s, inconsistent, ifaces, {|s, p|
|
word_space(s, ":");
|
||||||
print_path(s, p.path, false)});
|
commasep(s, inconsistent, ifaces, {|s, p|
|
||||||
|
print_path(s, p.path, false)});
|
||||||
|
}
|
||||||
bopen(s);
|
bopen(s);
|
||||||
hardbreak_if_not_bol(s);
|
hardbreak_if_not_bol(s);
|
||||||
maybe_print_comment(s, ctor.span.lo);
|
maybe_print_comment(s, ctor.span.lo);
|
||||||
|
@ -3,7 +3,7 @@ import to_str::to_str;
|
|||||||
|
|
||||||
mod kitty {
|
mod kitty {
|
||||||
|
|
||||||
class cat implements to_str {
|
class cat : to_str {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
fn meow() {
|
||||||
|
@ -3,7 +3,7 @@ iface noisy {
|
|||||||
fn speak();
|
fn speak();
|
||||||
}
|
}
|
||||||
|
|
||||||
class cat implements noisy {
|
class cat : noisy {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
fn meow() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// error-pattern:unresolved typename: nonexistent
|
// error-pattern:unresolved typename: nonexistent
|
||||||
class cat implements nonexistent {
|
class cat : nonexistent {
|
||||||
let meows: uint;
|
let meows: uint;
|
||||||
new(in_x : uint) { self.meows = in_x; }
|
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;
|
let meows: uint;
|
||||||
new(in_x : uint) { self.meows = in_x; }
|
new(in_x : uint) { self.meows = in_x; }
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ iface animal {
|
|||||||
fn eat();
|
fn eat();
|
||||||
}
|
}
|
||||||
|
|
||||||
class cat implements animal {
|
class cat : animal {
|
||||||
let meows: uint;
|
let meows: uint;
|
||||||
new(in_x : uint) { self.meows = in_x; }
|
new(in_x : uint) { self.meows = in_x; }
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import to_str::*;
|
import to_str::*;
|
||||||
import to_str::to_str;
|
import to_str::to_str;
|
||||||
|
|
||||||
class cat implements to_str {
|
class cat : to_str {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
fn meow() {
|
||||||
|
@ -2,7 +2,7 @@ iface noisy {
|
|||||||
fn speak() -> int;
|
fn speak() -> int;
|
||||||
}
|
}
|
||||||
|
|
||||||
class dog implements noisy {
|
class dog : noisy {
|
||||||
priv {
|
priv {
|
||||||
let barks : @mut uint;
|
let barks : @mut uint;
|
||||||
fn bark() -> int {
|
fn bark() -> int {
|
||||||
@ -26,7 +26,7 @@ class dog implements noisy {
|
|||||||
fn speak() -> int { self.bark() }
|
fn speak() -> int { self.bark() }
|
||||||
}
|
}
|
||||||
|
|
||||||
class cat implements noisy {
|
class cat : noisy {
|
||||||
priv {
|
priv {
|
||||||
let meows : @mut uint;
|
let meows : @mut uint;
|
||||||
fn meow() -> uint {
|
fn meow() -> uint {
|
||||||
|
@ -2,7 +2,7 @@ iface noisy {
|
|||||||
fn speak();
|
fn speak();
|
||||||
}
|
}
|
||||||
|
|
||||||
class cat implements noisy {
|
class cat : noisy {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
fn meow() {
|
||||||
|
@ -2,7 +2,7 @@ use std;
|
|||||||
import std::map::{map, hashmap, int_hash};
|
import std::map::{map, hashmap, int_hash};
|
||||||
|
|
||||||
class keys<K: copy, V: copy, M: copy map<K,V>>
|
class keys<K: copy, V: copy, M: copy map<K,V>>
|
||||||
implements iter::base_iter<K> {
|
: iter::base_iter<K> {
|
||||||
|
|
||||||
let map: M;
|
let map: M;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
use std;
|
use std;
|
||||||
import std::map::*;
|
import std::map::*;
|
||||||
|
|
||||||
class cat implements map<int, bool> {
|
class cat : map<int, bool> {
|
||||||
priv {
|
priv {
|
||||||
// Yes, you can have negative meows
|
// Yes, you can have negative meows
|
||||||
let mut meows : int;
|
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
|
// for any int value that's less than the meows field
|
||||||
|
|
||||||
// ok: T should be in scope when resolving the iface ref for map
|
// 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 {
|
priv {
|
||||||
// Yes, you can have negative meows
|
// Yes, you can have negative meows
|
||||||
let mut meows : int;
|
let mut meows : int;
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use cci_class_iface;
|
use cci_class_iface;
|
||||||
import cci_class_iface::animals::*;
|
import cci_class_iface::animals::*;
|
||||||
|
|
||||||
class cat implements noisy {
|
class cat : noisy {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
fn meow() {
|
||||||
|
@ -2,7 +2,7 @@ iface noisy {
|
|||||||
fn speak();
|
fn speak();
|
||||||
}
|
}
|
||||||
|
|
||||||
class cat implements noisy {
|
class cat : noisy {
|
||||||
priv {
|
priv {
|
||||||
let mut meows : uint;
|
let mut meows : uint;
|
||||||
fn meow() {
|
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
|
// vtables other than the 1st one don't seem to work
|
||||||
class cat implements noisy, scratchy, bitey {
|
class cat : noisy, scratchy, bitey {
|
||||||
priv {
|
priv {
|
||||||
let meows : @mut uint;
|
let meows : @mut uint;
|
||||||
let scratched : dvec<furniture>;
|
let scratched : dvec<furniture>;
|
||||||
|
Loading…
Reference in New Issue
Block a user