[vala/1270-remove-static-codecontext-access: 11/44] Genie.Scanner: use instance context's report log methods




commit 9e29c320a8b8bc1ba13286d7cfa36c99978d55ab
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 00:09:18 2021 -0600

    Genie.Scanner: use instance context's report log methods
    
    Avoids to use static Report methods

 vala/valageniescanner.vala | 82 +++++++++++++++++++++++-----------------------
 1 file changed, 41 insertions(+), 41 deletions(-)
---
diff --git a/vala/valageniescanner.vala b/vala/valageniescanner.vala
index ef54ae7d3..4270bf45d 100644
--- a/vala/valageniescanner.vala
+++ b/vala/valageniescanner.vala
@@ -136,25 +136,25 @@ public class Vala.Genie.Scanner {
                                        switch (current[0]) {
                                        case 'i':
                                                if (fl_i) {
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "modifier 'i' used more than once");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "modifier 'i' used more than once");
                                                }
                                                fl_i = true;
                                                break;
                                        case 's':
                                                if (fl_s) {
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "modifier 's' used more than once");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "modifier 's' used more than once");
                                                }
                                                fl_s = true;
                                                break;
                                        case 'm':
                                                if (fl_m) {
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "modifier 'm' used more than once");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "modifier 'm' used more than once");
                                                }
                                                fl_m = true;
                                                break;
                                        case 'x':
                                                if (fl_x) {
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "modifier 'x' used more than once");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "modifier 'x' used more than once");
                                                }
                                                fl_x = true;
                                                break;
@@ -240,9 +240,9 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\u used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\u used with no following hex digits");
                                                        } else if (digit_length < 4) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "incomplete universal character name");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "incomplete universal character name");
                                                        }
                                                        break;
                                                case 'x':
@@ -258,9 +258,9 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\x used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\x used with no following hex digits");
                                                        } else if (digit_length > 2) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "hex escape sequence out of range");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "hex escape sequence out of range");
                                                        }
                                                        break;
                                                default:
@@ -273,7 +273,7 @@ public class Vala.Genie.Scanner {
                                                                        token_length_in_chars++;
                                                                }
                                                        } else {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "invalid escape sequence");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid escape sequence");
                                                        }
                                                        break;
                                                }
@@ -286,12 +286,12 @@ public class Vala.Genie.Scanner {
                                                        token_length_in_chars++;
                                                } else {
                                                        current++;
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "invalid UTF-8 character");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid UTF-8 character");
                                                }
                                        }
                                }
                                if (current >= end || current[0] == '\n') {
-                                       Report.error (get_source_reference (token_length_in_chars), "syntax 
error, expected \"");
+                                       source_file.context.report.log_error (get_source_reference 
(token_length_in_chars), "syntax error, expected \"");
                                        state_stack.length--;
                                        return read_token (out token_begin, out token_end);
                                }
@@ -731,7 +731,7 @@ public class Vala.Genie.Scanner {
                                        current++;
                                        state_stack += State.TEMPLATE_PART;
                                } else {
-                                       Report.error (get_source_reference (1), "unexpected character");
+                                       source_file.context.report.log_error (get_source_reference (1), 
"unexpected character");
                                        return read_template_token (out token_begin, out token_end);
                                }
                                break;
@@ -770,9 +770,9 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\u used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\u used with no following hex digits");
                                                        } else if (digit_length < 4) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "incomplete universal character name");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "incomplete universal character name");
                                                        }
                                                        break;
                                                case 'x':
@@ -788,13 +788,13 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\x used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\x used with no following hex digits");
                                                        } else if (digit_length > 2) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "hex escape sequence out of range");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "hex escape sequence out of range");
                                                        }
                                                        break;
                                                default:
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "invalid escape sequence");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid escape sequence");
                                                        break;
                                                }
                                        } else if (current[0] == '\n') {
@@ -809,12 +809,12 @@ public class Vala.Genie.Scanner {
                                                        token_length_in_chars++;
                                                } else {
                                                        current++;
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "invalid UTF-8 character");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid UTF-8 character");
                                                }
                                        }
                                }
                                if (current >= end) {
-                                       Report.error (get_source_reference (token_length_in_chars), "syntax 
error, expected \"");
+                                       source_file.context.report.log_error (get_source_reference 
(token_length_in_chars), "syntax error, expected \"");
                                        state_stack.length--;
                                        return read_token (out token_begin, out token_end);
                                }
@@ -1303,14 +1303,14 @@ public class Vala.Genie.Scanner {
                                                                current += u.to_utf8 (null);
                                                                token_length_in_chars++;
                                                        } else {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "invalid UTF-8 character");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid UTF-8 character");
                                                        }
                                                }
                                        }
                                        if (current[0] == '"' && current[1] == '"' && current[2] == '"') {
                                                current += 3;
                                        } else {
-                                               Report.error (get_source_reference (token_length_in_chars), 
"syntax error, expected \"\"\"");
+                                               source_file.context.report.log_error (get_source_reference 
(token_length_in_chars), "syntax error, expected \"\"\"");
                                        }
                                        break;
                                } else {
@@ -1350,9 +1350,9 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\u used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\u used with no following hex digits");
                                                        } else if (digit_length < 4) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "incomplete universal character name");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "incomplete universal character name");
                                                        }
                                                        break;
                                                case 'x':
@@ -1368,13 +1368,13 @@ public class Vala.Genie.Scanner {
                                                                token_length_in_chars++;
                                                        }
                                                        if (digit_length < 1) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "\\x used with no following hex digits");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "\\x used with no following hex digits");
                                                        } else if (digit_length > 2) {
-                                                               Report.error (get_source_reference 
(token_length_in_chars), "hex escape sequence out of range");
+                                                               source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "hex escape sequence out of range");
                                                        }
                                                        break;
                                                default:
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "invalid escape sequence");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid escape sequence");
                                                        break;
                                                }
                                        } else if (current[0] == '\n') {
@@ -1389,28 +1389,28 @@ public class Vala.Genie.Scanner {
                                                        token_length_in_chars++;
                                                } else {
                                                        current++;
-                                                       Report.error (get_source_reference 
(token_length_in_chars), "invalid UTF-8 character");
+                                                       source_file.context.report.log_error 
(get_source_reference (token_length_in_chars), "invalid UTF-8 character");
                                                }
                                        }
                                        if (current < end && begin[0] == '\'' && current[0] != '\'') {
                                                // multiple characters in single character literal
-                                               Report.error (get_source_reference (token_length_in_chars), 
"invalid character literal");
+                                               source_file.context.report.log_error (get_source_reference 
(token_length_in_chars), "invalid character literal");
                                        }
                                }
                                if (current < end) {
                                        current++;
                                } else {
-                                       Report.error (get_source_reference (token_length_in_chars), "syntax 
error, expected %c", begin[0]);
+                                       source_file.context.report.log_error (get_source_reference 
(token_length_in_chars), "syntax error, expected %c", begin[0]);
                                }
                                break;
                        default:
                                unichar u = ((string) current).get_char_validated ((long) (end - current));
                                if (u != (unichar) (-1)) {
                                        current += u.to_utf8 (null);
-                                       Report.error (get_source_reference (0), "syntax error, unexpected 
character");
+                                       source_file.context.report.log_error (get_source_reference (0), 
"syntax error, unexpected character");
                                } else {
                                        current++;
-                                       Report.error (get_source_reference (0), "invalid UTF-8 character");
+                                       source_file.context.report.log_error (get_source_reference (0), 
"invalid UTF-8 character");
                                }
                                column++;
                                return read_token (out token_begin, out token_end);
@@ -1574,7 +1574,7 @@ public class Vala.Genie.Scanner {
                                column++;
                        }
                        if (current == end - 1) {
-                               Report.error (get_source_reference (0), "syntax error, expected */");
+                               source_file.context.report.log_error (get_source_reference (0), "syntax 
error, expected */");
                                return true;
                        }
 
@@ -1687,7 +1687,7 @@ public class Vala.Genie.Scanner {
                } else if (len == 5 && matches (begin, "endif")) {
                        parse_pp_endif ();
                } else {
-                       Report.error (get_source_reference (-len, len), "syntax error, invalid preprocessing 
directive");
+                       source_file.context.report.log_error (get_source_reference (-len, len), "syntax 
error, invalid preprocessing directive");
                }
 
                if (conditional_stack.length > 0
@@ -1717,7 +1717,7 @@ public class Vala.Genie.Scanner {
        void pp_eol () {
                pp_space ();
                if (current >= end || current[0] != '\n') {
-                       Report.error (get_source_reference (0), "syntax error, expected newline");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
expected newline");
                }
        }
 
@@ -1747,7 +1747,7 @@ public class Vala.Genie.Scanner {
                pp_eol ();
 
                if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 
1].else_found) {
-                       Report.error (get_source_reference (0), "syntax error, unexpected #elif");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
unexpected #elif");
                        return;
                }
 
@@ -1766,7 +1766,7 @@ public class Vala.Genie.Scanner {
                pp_eol ();
 
                if (conditional_stack.length == 0 || conditional_stack[conditional_stack.length - 
1].else_found) {
-                       Report.error (get_source_reference (0), "syntax error, unexpected #else");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
unexpected #else");
                        return;
                }
 
@@ -1785,7 +1785,7 @@ public class Vala.Genie.Scanner {
                pp_eol ();
 
                if (conditional_stack.length == 0) {
-                       Report.error (get_source_reference (0), "syntax error, unexpected #endif");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
unexpected #endif");
                        return;
                }
 
@@ -1801,7 +1801,7 @@ public class Vala.Genie.Scanner {
                }
 
                if (len == 0) {
-                       Report.error (get_source_reference (0), "syntax error, expected identifier");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
expected identifier");
                        return false;
                }
 
@@ -1820,7 +1820,7 @@ public class Vala.Genie.Scanner {
 
        bool parse_pp_primary_expression () {
                if (current >= end) {
-                       Report.error (get_source_reference (0), "syntax error, expected identifier");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
expected identifier");
                } else if (is_ident_char (current[0])) {
                        return parse_pp_symbol ();
                } else if (current[0] == '(') {
@@ -1833,11 +1833,11 @@ public class Vala.Genie.Scanner {
                                current++;
                                column++;
                        } else {
-                               Report.error (get_source_reference (0), "syntax error, expected `)'");
+                               source_file.context.report.log_error (get_source_reference (0), "syntax 
error, expected `)'");
                        }
                        return result;
                } else {
-                       Report.error (get_source_reference (0), "syntax error, expected identifier");
+                       source_file.context.report.log_error (get_source_reference (0), "syntax error, 
expected identifier");
                }
                return false;
        }


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