[vala/parallel-0.10: 20/37] Do not create empty type parameter lists in parser
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/parallel-0.10: 20/37] Do not create empty type parameter lists in parser
- Date: Mon, 6 Sep 2010 13:16:54 +0000 (UTC)
commit f13749b1ffe2d60b0581becb8ff2169d1481c95b
Author: Jürg Billeter <j bitron ch>
Date: Sat Aug 21 12:11:58 2010 +0200
Do not create empty type parameter lists in parser
vala/valaparser.vala | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index f7dc50b..093cd4e 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -41,6 +41,8 @@ public class Vala.Parser : CodeVisitor {
const int BUFFER_SIZE = 32;
+ static List<TypeParameter> _empty_type_parameter_list;
+
struct TokenInfo {
public TokenType type;
public SourceLocation begin;
@@ -3425,16 +3427,21 @@ public class Vala.Parser : CodeVisitor {
}
List<TypeParameter> parse_type_parameter_list () throws ParseError {
- var list = new ArrayList<TypeParameter> ();
if (accept (TokenType.OP_LT)) {
+ var list = new ArrayList<TypeParameter> ();
do {
var begin = get_location ();
string id = parse_identifier ();
list.add (new TypeParameter (id, get_src (begin)));
} while (accept (TokenType.COMMA));
expect (TokenType.OP_GT);
+ return list;
+ } else {
+ if (_empty_type_parameter_list == null) {
+ _empty_type_parameter_list = new ArrayList<TypeParameter> ();
+ }
+ return _empty_type_parameter_list;
}
- return list;
}
void skip_type_argument_list () throws ParseError {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]