[vala/0.50] Slightly improve source_reference for get_dup_func_expression()



commit eec7b5ef0b5875f2b6aafbbd024172c0842b80e1
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Fri Aug 6 08:40:31 2021 +0200

    Slightly improve source_reference for get_dup_func_expression()

 codegen/valaccodebasemodule.vala | 4 ++--
 codegen/valagtypemodule.vala     | 2 +-
 vala/valasemanticanalyzer.vala   | 1 +
 vala/valasymbolresolver.vala     | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 0e14461ab..ef7a1535e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2924,7 +2924,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                }
                        } else {
                                // duplicating non-reference counted objects may cause side-effects (and 
performance issues)
-                               Report.error (source_reference, "duplicating %s instance, use unowned 
variable or explicitly invoke copy method".printf (type.type_symbol.name));
+                               Report.error (source_reference, "duplicating `%s' instance, use unowned 
variable or explicitly invoke copy method".printf (type.type_symbol.name));
                                return new CCodeInvalidExpression();
                        }
 
@@ -4796,7 +4796,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
 
                        arg_map.set (get_param_pos (0.1 * type_param_index + 0.02), get_type_id_expression 
(type_arg, is_chainup));
                        if (requires_copy (type_arg)) {
-                               var dup_func = get_dup_func_expression (type_arg, type_arg.source_reference, 
is_chainup);
+                               var dup_func = get_dup_func_expression (type_arg, type_arg.source_reference 
?? expr.source_reference, is_chainup);
                                if (dup_func == null) {
                                        // type doesn't contain a copy function
                                        expr.error = true;
diff --git a/codegen/valagtypemodule.vala b/codegen/valagtypemodule.vala
index 4f0ea8670..b9ff448ff 100644
--- a/codegen/valagtypemodule.vala
+++ b/codegen/valagtypemodule.vala
@@ -1430,7 +1430,7 @@ public class Vala.GTypeModule : GErrorModule {
 
                                add_generic_accessor_function ("get_%s_dup_func".printf (p.name.ascii_down 
()),
                                                               "GBoxedCopyFunc",
-                                                              get_dup_func_expression (p_data_type, null),
+                                                              get_dup_func_expression (p_data_type, 
p_data_type.source_reference),
                                                               p, cl, iface);
 
                                add_generic_accessor_function ("get_%s_destroy_func".printf 
(p.name.ascii_down ()),
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index fed1e86b0..46857bd52 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -1001,6 +1001,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
                        return generic_type;
                }
                actual_type = actual_type.copy ();
+               actual_type.source_reference = generic_type.source_reference;
                actual_type.value_owned = actual_type.value_owned && generic_type.value_owned;
                return actual_type;
        }
diff --git a/vala/valasymbolresolver.vala b/vala/valasymbolresolver.vala
index 3f9bc6de0..98d5e150e 100644
--- a/vala/valasymbolresolver.vala
+++ b/vala/valasymbolresolver.vala
@@ -427,7 +427,7 @@ public class Vala.SymbolResolver : CodeVisitor {
 
                // still required for vapigen
                if (unresolved_type.unresolved_symbol.name == "void") {
-                       return new VoidType ();
+                       return new VoidType (unresolved_type.source_reference);
                }
 
                var sym = resolve_symbol (unresolved_type.unresolved_symbol);


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