diff options
author | Jamie McCracken <jamie.mccrack@gmail.com> | 2010-09-27 23:37:18 -0400 |
---|---|---|
committer | Jamie McCracken <jamie.mccrack@gmail.com> | 2010-09-27 23:37:18 -0400 |
commit | 610674e8e2c440c203e02cc3760a86453b647514 (patch) | |
tree | 4744b4522ddf02fa2aa758837ea92f89d463f101 /vala/valagenieparser.vala | |
parent | 75bc4ba14e11072726b05d491c3ceac2bf3e8cec (diff) | |
download | vala-610674e8e2c440c203e02cc3760a86453b647514.tar.gz |
Genie: Do not create empty type parameter lists in parser
Diffstat (limited to 'vala/valagenieparser.vala')
-rw-r--r-- | vala/valagenieparser.vala | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index 4087a370e..f04befbd4 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 { |