[vala/0.54] vala: Report statement parsing error if it is not meant to be an expression
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.54] vala: Report statement parsing error if it is not meant to be an expression
- Date: Thu, 16 Dec 2021 07:23:40 +0000 (UTC)
commit 12fb135ba3cf8b1044d65f040eef02c1fe982758
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Dec 13 12:38:01 2021 +0100
vala: Report statement parsing error if it is not meant to be an expression
Fixes https://gitlab.gnome.org/GNOME/vala/issues/1261
vala/valaparser.vala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index f85d78e09..581092de2 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -1683,8 +1683,12 @@ public class Vala.Parser : CodeVisitor {
} catch (ParseError e) {
var e_begin = get_location ();
string token = ((EnumClass) typeof (TokenType).class_ref ()).get_value
(type).value_nick;
+ rollback (begin);
+ if (!is_expression ()) {
+ rollback (e_begin);
+ throw e;
+ }
try {
- rollback (begin);
stmt = parse_expression_statement ();
Report.warning (get_src (begin), "`%s' is a syntax keyword, replace with
`@%s'", token, token);
} catch (ParseError e2) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]