[vala/0.42] parser: Restrict source_reference for catch/lock expression to its header
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.42] parser: Restrict source_reference for catch/lock expression to its header
- Date: Wed, 10 Apr 2019 14:27:00 +0000 (UTC)
commit e2352a3a20b97f927b15a253e364fedeecd4c3eb
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Fri Mar 8 18:46:02 2019 +0100
parser: Restrict source_reference for catch/lock expression to its header
vala/valaparser.vala | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 59d659f35..239de6bc1 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2113,8 +2113,9 @@ public class Vala.Parser : CodeVisitor {
}
void parse_catch_clauses (List<CatchClause> catch_clauses) throws ParseError {
- while (accept (TokenType.CATCH)) {
+ while (current () == TokenType.CATCH) {
var begin = get_location ();
+ expect (TokenType.CATCH);
DataType type = null;
string id = null;
if (accept (TokenType.OPEN_PARENS)) {
@@ -2122,8 +2123,9 @@ public class Vala.Parser : CodeVisitor {
id = parse_identifier ();
expect (TokenType.CLOSE_PARENS);
}
+ var src = get_src (begin);
var block = parse_block ();
- catch_clauses.add (new CatchClause (type, id, block, get_src (begin)));
+ catch_clauses.add (new CatchClause (type, id, block, src));
}
}
@@ -2139,11 +2141,12 @@ public class Vala.Parser : CodeVisitor {
expect (TokenType.OPEN_PARENS);
var expr = parse_expression ();
expect (TokenType.CLOSE_PARENS);
+ var src = get_src (begin);
Block? stmt = null;
if (current () != TokenType.SEMICOLON) {
stmt = parse_embedded_statement ("lock", false);
}
- return new LockStatement (expr, stmt, get_src (begin));
+ return new LockStatement (expr, stmt, src);
}
Statement parse_unlock_statement () throws ParseError {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]