[vala] Genie: Do not create empty type parameter lists in parser
- From: Jamie McCracken <jamiemcc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala] Genie: Do not create empty type parameter lists in parser
- Date: Tue, 28 Sep 2010 03:47:04 +0000 (UTC)
commit 610674e8e2c440c203e02cc3760a86453b647514
Author: Jamie McCracken <jamie mccrack gmail com>
Date: Mon Sep 27 23:37:18 2010 -0400
Genie: Do not create empty type parameter lists in parser
vala/valagenieparser.vala | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 4087a37..f04befb 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -48,6 +48,8 @@ public class Vala.Genie.Parser : CodeVisitor {
const int BUFFER_SIZE = 32;
+ static List<TypeParameter> _empty_type_parameter_list;
+
struct TokenInfo {
public TokenType type;
public SourceLocation begin;
@@ -3738,16 +3740,20 @@ public class Vala.Genie.Parser : CodeVisitor {
}
List<TypeParameter> parse_type_parameter_list () throws ParseError {
- var list = new ArrayList<TypeParameter> ();
if (accept (TokenType.OF)) {
+ 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));
-
+ 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]