diff options
| author | Graydon Hoare <graydon@mozilla.com> | 2012-06-22 18:19:35 -0700 |
|---|---|---|
| committer | Graydon Hoare <graydon@mozilla.com> | 2012-06-22 18:57:20 -0700 |
| commit | f60cdf27e76f9e8c195246e90bfd944680cd7617 (patch) | |
| tree | 4bd8e42e9958202e1e1a794aff96c20eedc0c715 | |
| parent | 3ed8561dea681fe15eac4c12010c6ede0840088c (diff) | |
| download | rust-f60cdf27e76f9e8c195246e90bfd944680cd7617.tar.gz rust-f60cdf27e76f9e8c195246e90bfd944680cd7617.zip | |
Remove 'implements' keyword in favour of :, part of #2301.
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/token.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 8 | ||||
| -rw-r--r-- | src/test/auxiliary/cci_class_cast.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/class-cast-to-iface.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/class-implements-bad-iface.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/class-implements-int.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/class-method-missing.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-cast-to-iface-cross-crate.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-cast-to-iface-multiple-types.rs | 4 | ||||
| -rw-r--r-- | src/test/run-pass/class-cast-to-iface.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-iface-bounded-param.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-impl-parameterized-iface.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-impl-very-parameterized-iface.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-implement-iface-cross-crate.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-implement-ifaces.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/class-implements-multiple-ifaces.rs | 2 |
17 files changed, 21 insertions, 20 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 46e838fd4be..28fee93fad7 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -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); diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 39327f1efad..0a166dceb1d 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -251,7 +251,6 @@ fn contextual_keyword_table() -> hashmap<str, ()> { let keys = [ "as", "else", - "implements", "move", "of", "priv", "pub", diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 89f3b2d3aba..f632f3bcc21 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -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); diff --git a/src/test/auxiliary/cci_class_cast.rs b/src/test/auxiliary/cci_class_cast.rs index 997cab28155..63b8426ac93 100644 --- a/src/test/auxiliary/cci_class_cast.rs +++ b/src/test/auxiliary/cci_class_cast.rs @@ -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() { diff --git a/src/test/compile-fail/class-cast-to-iface.rs b/src/test/compile-fail/class-cast-to-iface.rs index 2088d716ed7..e79c021d9f3 100644 --- a/src/test/compile-fail/class-cast-to-iface.rs +++ b/src/test/compile-fail/class-cast-to-iface.rs @@ -3,7 +3,7 @@ iface noisy { fn speak(); } -class cat implements noisy { +class cat : noisy { priv { let mut meows : uint; fn meow() { diff --git a/src/test/compile-fail/class-implements-bad-iface.rs b/src/test/compile-fail/class-implements-bad-iface.rs index ff7d9fbe327..4e95b986a9a 100644 --- a/src/test/compile-fail/class-implements-bad-iface.rs +++ b/src/test/compile-fail/class-implements-bad-iface.rs @@ -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; } } diff --git a/src/test/compile-fail/class-implements-int.rs b/src/test/compile-fail/class-implements-int.rs index 7a2a7ad4f94..1768b8c4bf0 100644 --- a/src/test/compile-fail/class-implements-int.rs +++ b/src/test/compile-fail/class-implements-int.rs @@ -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; } } diff --git a/src/test/compile-fail/class-method-missing.rs b/src/test/compile-fail/class-method-missing.rs index 6e6092fceab..788baa73c34 100644 --- a/src/test/compile-fail/class-method-missing.rs +++ b/src/test/compile-fail/class-method-missing.rs @@ -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; } } diff --git a/src/test/run-pass/class-cast-to-iface-cross-crate.rs b/src/test/run-pass/class-cast-to-iface-cross-crate.rs index 14722b71794..13c0e60c427 100644 --- a/src/test/run-pass/class-cast-to-iface-cross-crate.rs +++ b/src/test/run-pass/class-cast-to-iface-cross-crate.rs @@ -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() { diff --git a/src/test/run-pass/class-cast-to-iface-multiple-types.rs b/src/test/run-pass/class-cast-to-iface-multiple-types.rs index 84bc53ac807..e2dc7b732a8 100644 --- a/src/test/run-pass/class-cast-to-iface-multiple-types.rs +++ b/src/test/run-pass/class-cast-to-iface-multiple-types.rs @@ -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 { diff --git a/src/test/run-pass/class-cast-to-iface.rs b/src/test/run-pass/class-cast-to-iface.rs index 90b3d67cb59..10222acc45a 100644 --- a/src/test/run-pass/class-cast-to-iface.rs +++ b/src/test/run-pass/class-cast-to-iface.rs @@ -2,7 +2,7 @@ iface noisy { fn speak(); } -class cat implements noisy { +class cat : noisy { priv { let mut meows : uint; fn meow() { diff --git a/src/test/run-pass/class-iface-bounded-param.rs b/src/test/run-pass/class-iface-bounded-param.rs index fd0ea20b5fb..4da75037421 100644 --- a/src/test/run-pass/class-iface-bounded-param.rs +++ b/src/test/run-pass/class-iface-bounded-param.rs @@ -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; diff --git a/src/test/run-pass/class-impl-parameterized-iface.rs b/src/test/run-pass/class-impl-parameterized-iface.rs index b7533bfe426..dc76b57c2d2 100644 --- a/src/test/run-pass/class-impl-parameterized-iface.rs +++ b/src/test/run-pass/class-impl-parameterized-iface.rs @@ -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; diff --git a/src/test/run-pass/class-impl-very-parameterized-iface.rs b/src/test/run-pass/class-impl-very-parameterized-iface.rs index 89674fecfa4..30c4be25c60 100644 --- a/src/test/run-pass/class-impl-very-parameterized-iface.rs +++ b/src/test/run-pass/class-impl-very-parameterized-iface.rs @@ -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; diff --git a/src/test/run-pass/class-implement-iface-cross-crate.rs b/src/test/run-pass/class-implement-iface-cross-crate.rs index 62f8cdb39f8..5add42fb263 100644 --- a/src/test/run-pass/class-implement-iface-cross-crate.rs +++ b/src/test/run-pass/class-implement-iface-cross-crate.rs @@ -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() { diff --git a/src/test/run-pass/class-implement-ifaces.rs b/src/test/run-pass/class-implement-ifaces.rs index 0dcf3c8104a..f772ef957d7 100644 --- a/src/test/run-pass/class-implement-ifaces.rs +++ b/src/test/run-pass/class-implement-ifaces.rs @@ -2,7 +2,7 @@ iface noisy { fn speak(); } -class cat implements noisy { +class cat : noisy { priv { let mut meows : uint; fn meow() { diff --git a/src/test/run-pass/class-implements-multiple-ifaces.rs b/src/test/run-pass/class-implements-multiple-ifaces.rs index 1a8f7777672..fe3f160c1f8 100644 --- a/src/test/run-pass/class-implements-multiple-ifaces.rs +++ b/src/test/run-pass/class-implements-multiple-ifaces.rs @@ -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>; |
