diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-09-22 14:44:40 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2018-09-22 16:28:33 +0200 |
commit | 898e45a6ff6129fc5c674af48118042dd64123ff (patch) | |
tree | 9d87af16507e5710862eeeca57696ca922341e36 /vala/valagenieparser.vala | |
parent | ce7c31eaff13fcd8c2da7a0d52deb8f97043df24 (diff) | |
download | vala-898e45a6ff6129fc5c674af48118042dd64123ff.tar.gz |
vala: Enforce "return yield ..." syntax to be expected
"yield return ..." wasn't handled correctly and resulted in broken c-code.
Fixes https://gitlab.gnome.org/GNOME/vala/issues/675
Diffstat (limited to 'vala/valagenieparser.vala')
-rw-r--r-- | vala/valagenieparser.vala | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala index 24c638492..0220deafa 100644 --- a/vala/valagenieparser.vala +++ b/vala/valagenieparser.vala @@ -2260,16 +2260,12 @@ public class Vala.Genie.Parser : CodeVisitor { Statement parse_yield_statement () throws ParseError { var begin = get_location (); expect (TokenType.YIELD); - if (current () != TokenType.SEMICOLON && current () != TokenType.EOL && current () != TokenType.RETURN) { + if (current () != TokenType.SEMICOLON && current () != TokenType.EOL) { prev (); return parse_expression_statement (); } - Expression expr = null; - if (accept (TokenType.RETURN)) { - expr = parse_expression (); - } expect_terminator (); - return new YieldStatement (expr, get_src (begin)); + return new YieldStatement (get_src (begin)); } Statement parse_throw_statement () throws ParseError { |