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




commit 7260d74d00495c265fd4c2f526b73de32b0baca0
Author: Daniel Espinosa <esodan gmail com>
Date:   Wed Dec 29 00:05:28 2021 -0600

    Genie.Parser: use context's report instance log methods
    
    Avoid to use static methods to access context's report
    instance

 vala/valagenieparser.vala | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/vala/valagenieparser.vala b/vala/valagenieparser.vala
index 0b0e242e3..87a125f22 100644
--- a/vala/valagenieparser.vala
+++ b/vala/valagenieparser.vala
@@ -163,7 +163,7 @@ public class Vala.Genie.Parser : CodeVisitor {
        void report_parse_error (ParseError e) {
                var begin = get_location ();
                next ();
-               Report.error (get_src (begin), "syntax error, %s", e.message);
+               context.report.log_error (get_src (begin), "syntax error, %s", e.message);
        }
 
        inline bool expect (TokenType type) throws ParseError {
@@ -373,7 +373,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        // FIXME validate and unescape here and just pass unichar to CharacterLiteral
                        var lit = new CharacterLiteral (get_last_string (), get_src (begin));
                        if (lit.error) {
-                               Report.error (lit.source_reference, "invalid character literal");
+                               context.report.log_error (lit.source_reference, "invalid character literal");
                        }
                        return lit;
                case TokenType.REGEX_LITERAL:
@@ -514,7 +514,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                                value_owned = false;
                        } else if (accept (TokenType.WEAK)) {
                                if (!can_weak_ref && !context.deprecated) {
-                                       Report.warning (get_src (begin), "deprecated syntax, use `unowned` 
modifier");
+                                       context.report.log_warning (get_src (begin), "deprecated syntax, use 
`unowned` modifier");
                                }
                                value_owned = false;
                        }
@@ -1204,7 +1204,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                unowned MethodCall? call = expr as MethodCall;
                unowned ObjectCreationExpression? object_creation = expr as ObjectCreationExpression;
                if (call == null && object_creation == null) {
-                       Report.error (expr.source_reference, "syntax error, expected method call");
+                       context.report.log_error (expr.source_reference, "syntax error, expected method 
call");
                        throw new ParseError.SYNTAX ("expected method call");
                }
 
@@ -1941,7 +1941,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                if (!accept (TokenType.DEDENT)) {
                        // only report error if it's not a secondary error
                        if (context.report.get_errors () == 0) {
-                               Report.error (get_current_src (), "tab indentation is incorrect");
+                               context.report.log_error (get_current_src (), "tab indentation is incorrect");
                        }
                }
 
@@ -2414,7 +2414,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                if (attributes != null) {
                        foreach (Attribute attr in (List<Attribute>) attributes) {
                                if (node.get_attribute (attr.name) != null) {
-                                       Report.error (attr.source_reference, "duplicate attribute `%s'", 
attr.name);
+                                       context.report.log_error (attr.source_reference, "duplicate attribute 
`%s'", attr.name);
                                }
                                node.attributes.append (attr);
                        }
@@ -2518,7 +2518,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                        if (!accept (TokenType.DEDENT)) {
                                // only report error if it's not a secondary error
                                if (context.report.get_errors () == 0) {
-                                       Report.error (get_current_src (), "expected dedent");
+                                       context.report.log_error (get_current_src (), "expected dedent");
                                }
                        }
                }
@@ -2626,7 +2626,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Constant) {
                        ns.add_constant ((Constant) sym);
                } else {
-                       Report.error (sym.source_reference, "unexpected declaration in namespace");
+                       context.report.log_error (sym.source_reference, "unexpected declaration in 
namespace");
                }
        }
 
@@ -2758,7 +2758,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Destructor) {
                        cl.add_destructor ((Destructor) sym);
                } else {
-                       Report.error (sym.source_reference, "unexpected declaration in class");
+                       context.report.log_error (sym.source_reference, "unexpected declaration in class");
                }
        }
 
@@ -2800,7 +2800,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                set_attributes (c, attrs);
 
                if (ModifierFlags.STATIC in flags) {
-                       Report.warning (c.source_reference, "the modifier `static' is not applicable to 
constants");
+                       context.report.log_warning (c.source_reference, "the modifier `static' is not 
applicable to constants");
                }
 
                return c;
@@ -2820,7 +2820,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                var f = new Field (id, type, null, get_src (begin), comment);
 
                if (ModifierFlags.ABSTRACT in flags || ModifierFlags.VIRTUAL in flags || 
ModifierFlags.OVERRIDE in flags) {
-                       Report.error (f.source_reference, "abstract, virtual, and override modifiers are not 
applicable to fields");
+                       context.report.log_error (f.source_reference, "abstract, virtual, and override 
modifiers are not applicable to fields");
                }
 
                if (ModifierFlags.PRIVATE in flags) {
@@ -3118,7 +3118,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                }
 
                if (ModifierFlags.ASYNC in flags) {
-                       Report.error (prop.source_reference, "async properties are not supported yet");
+                       context.report.log_error (prop.source_reference, "async properties are not supported 
yet");
                }
 
                if (accept (TokenType.ASSIGN)) {
@@ -3348,7 +3348,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Property) {
                        st.add_property ((Property) sym);
                } else {
-                       Report.error (sym.source_reference, "unexpected declaration in struct");
+                       context.report.log_error (sym.source_reference, "unexpected declaration in struct");
                }
        }
 
@@ -3427,7 +3427,7 @@ public class Vala.Genie.Parser : CodeVisitor {
                } else if (sym is Property) {
                        iface.add_property ((Property) sym);
                } else {
-                       Report.error (sym.source_reference, "unexpected declaration in interface");
+                       context.report.log_error (sym.source_reference, "unexpected declaration in 
interface");
                }
        }
 


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