From fd85239119ffba1c57a493603d63deed9be60521 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 7 Jun 2012 22:09:27 -0700 Subject: syntax: Remove several deep copies that were happening due to misuse of parse_seq --- src/libsyntax/parse/common.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse/common.rs') 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(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::(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(bra: token::token, ket: token::token, sep: seq_sep, f: fn(parser) -> T) -> spanned<[T]> { let lo = self.span.lo; -- cgit 1.4.1-3-g733a5