diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-08-07 18:10:06 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-08-08 18:19:24 -0700 |
| commit | 6a0720b439a4692f55d3b9951e74d452a7aef802 (patch) | |
| tree | d2dd72702f32e0254f7d72dd5782a8b6741d0004 /src/libsyntax/parse | |
| parent | e997948c8a70d76ffac3c60867d47f98e698988f (diff) | |
| download | rust-6a0720b439a4692f55d3b9951e74d452a7aef802.tar.gz rust-6a0720b439a4692f55d3b9951e74d452a7aef802.zip | |
Convert impls to new syntax
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/attr.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/comments.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/parse/common.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 8 |
5 files changed, 8 insertions, 11 deletions
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index aefa7264bf6..a93d25ced00 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -23,7 +23,7 @@ trait parser_attr { fn parse_optional_meta() -> ~[@ast::meta_item]; } -impl parser_attr of parser_attr for parser { +impl parser: parser_attr { fn parse_outer_attrs_or_ext(first_item_attrs: ~[ast::attribute]) -> attr_or_ext diff --git a/src/libsyntax/parse/comments.rs b/src/libsyntax/parse/comments.rs index 7c24f8b1245..d3c17b81298 100644 --- a/src/libsyntax/parse/comments.rs +++ b/src/libsyntax/parse/comments.rs @@ -1,8 +1,7 @@ -import io::reader_util; import io::println;//XXXXXXXXxxx import util::interner; import lexer::{string_reader, bump, is_eof, nextch, - is_whitespace, get_str_from, string_reader_as_reader, reader}; + is_whitespace, get_str_from, reader}; export cmnt; export lit; diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index 445e4c20eed..4038578d3f8 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -59,7 +59,7 @@ trait parser_common { f: fn(parser) -> T) -> spanned<~[T]>; } -impl parser_common of parser_common for parser { +impl parser: parser_common { fn unexpected_last(t: token::token) -> ! { self.span_fatal( copy self.last_span, diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index e9bfbc753f7..69dde491bdf 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -68,7 +68,7 @@ fn dup_string_reader(&&r: string_reader) -> string_reader { mut peek_tok: r.peek_tok, mut peek_span: r.peek_span} } -impl string_reader_as_reader of reader for string_reader { +impl string_reader: reader { fn is_eof() -> bool { is_eof(self) } fn next_token() -> {tok: token::token, sp: span} { let ret_val = {tok: self.peek_tok, sp: self.peek_span}; @@ -86,7 +86,7 @@ impl string_reader_as_reader of reader for string_reader { fn dup() -> reader { dup_string_reader(self) as reader } } -impl tt_reader_as_reader of reader for tt_reader { +impl tt_reader: reader { fn is_eof() -> bool { self.cur_tok == token::EOF } fn next_token() -> {tok: token::token, sp: span} { /* weird resolve bug: if the following `if`, or any of its diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c8a333bb6e1..a572290a6f1 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -8,12 +8,12 @@ import token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident, import codemap::{span,fss_none}; import util::interner; import ast_util::{spanned, respan, mk_sp, ident_to_path, operator_prec}; -import lexer::{reader, tt_reader_as_reader}; +import lexer::reader; import prec::{as_prec, token_to_binop}; import attr::parser_attr; import common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed, seq_sep_none, token_to_str}; -import dvec::{dvec, extensions}; +import dvec::dvec; import vec::{push}; import ast::{_mod, add, alt_check, alt_exhaustive, arg, arm, attribute, bind_by_ref, bind_by_implicit_ref, bind_by_value, @@ -2424,9 +2424,6 @@ class parser { } // Parses four variants (with the region/type params always optional): - // impl /&<T: copy> of to_str for ~[T] { ... } - // impl name/&<T> of to_str for ~[T] { ... } - // impl name/&<T> for ~[T] { ... } // impl<T> ~[T] : to_str { ... } fn parse_item_impl() -> item_info { fn wrap_path(p: parser, pt: @path) -> @ty { @@ -2466,6 +2463,7 @@ class parser { traits = ~[]; } } else { + self.warn(~"old-style named impl?"); let mut ident_old; if self.token == token::BINOP(token::SLASH) { self.parse_region_param(); |
