[vala/0.42] parser: Exclude trailing semicolon from source_reference of statements



commit 0b50969f5865a544412ac6b1e3fb22e43984804e
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Mar 8 18:46:02 2019 +0100

    parser: Exclude trailing semicolon from source_reference of statements

 vala/valaparser.vala | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/vala/valaparser.vala b/vala/valaparser.vala
index 42c300828..f20aceee3 100644
--- a/vala/valaparser.vala
+++ b/vala/valaparser.vala
@@ -2045,15 +2045,17 @@ public class Vala.Parser : CodeVisitor {
        Statement parse_break_statement () throws ParseError {
                var begin = get_location ();
                expect (TokenType.BREAK);
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new BreakStatement (get_src (begin));
+               return new BreakStatement (src);
        }
 
        Statement parse_continue_statement () throws ParseError {
                var begin = get_location ();
                expect (TokenType.CONTINUE);
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new ContinueStatement (get_src (begin));
+               return new ContinueStatement (src);
        }
 
        Statement parse_return_statement () throws ParseError {
@@ -2063,8 +2065,9 @@ public class Vala.Parser : CodeVisitor {
                if (current () != TokenType.SEMICOLON) {
                        expr = parse_expression ();
                }
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new ReturnStatement (expr, get_src (begin));
+               return new ReturnStatement (expr, src);
        }
 
        Statement parse_yield_statement () throws ParseError {
@@ -2079,16 +2082,18 @@ public class Vala.Parser : CodeVisitor {
                if (accept (TokenType.RETURN)) {
                        expr = parse_expression ();
                }
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new YieldStatement (expr, get_src (begin));
+               return new YieldStatement (expr, src);
        }
 
        Statement parse_throw_statement () throws ParseError {
                var begin = get_location ();
                expect (TokenType.THROW);
                var expr = parse_expression ();
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new ThrowStatement (expr, get_src (begin));
+               return new ThrowStatement (expr, src);
        }
 
        Statement parse_try_statement () throws ParseError {
@@ -2163,8 +2168,9 @@ public class Vala.Parser : CodeVisitor {
                var begin = get_location ();
                expect (TokenType.DELETE);
                var expr = parse_expression ();
+               var src = get_src (begin);
                expect (TokenType.SEMICOLON);
-               return new DeleteStatement (expr, get_src (begin));
+               return new DeleteStatement (expr, src);
        }
 
        string parse_attribute_value () throws ParseError {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]