diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-06-07 22:09:27 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-06-07 22:09:27 -0700 |
| commit | fd85239119ffba1c57a493603d63deed9be60521 (patch) | |
| tree | b2aef04cf54cac8d4598bd0bd63c6621c4d9010d /src/libsyntax/parse/common.rs | |
| parent | 26faa37305f59e2b09a92b089b78abc4f01da8e8 (diff) | |
| download | rust-fd85239119ffba1c57a493603d63deed9be60521.tar.gz rust-fd85239119ffba1c57a493603d63deed9be60521.zip | |
syntax: Remove several deep copies that were happening due to misuse of parse_seq
Diffstat (limited to 'src/libsyntax/parse/common.rs')
| -rw-r--r-- | src/libsyntax/parse/common.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libsyntax/parse/common.rs b/src/libsyntax/parse/common.rs index c0a2f9b9e6e..0c2718c3b4b 100644 --- a/src/libsyntax/parse/common.rs +++ b/src/libsyntax/parse/common.rs @@ -209,9 +209,16 @@ impl parser_common for parser { ret v; } - // FIXME: A lot of callers go through here, only to copy out the T and - // discard the spanned<> wrapper. I feel as though there should be a - // version of this that does not return a spanned result. + fn parse_unspanned_seq<T: copy>(bra: token::token, ket: token::token, + sep: seq_sep, f: fn(parser) -> T) -> [T] { + self.expect(bra); + let result = self.parse_seq_to_before_end::<T>(ket, sep, f); + self.bump(); + ret result; + } + + // NB: Do not use this function unless you actually plan to place the + // spanned list in the AST. fn parse_seq<T: copy>(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> spanned<[T]> { let lo = self.span.lo; |
