[vala/staging: 1/2] codewriter: Add 'new' to symbols if needed to match the original source



commit 4a15250f696f634670623d2aa79ec9395d900ab9
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Apr 24 21:00:20 2018 +0200

    codewriter: Add 'new' to symbols if needed to match the original source
    
    https://bugzilla.gnome.org/show_bug.cgi?id=614686

 vala/valacodewriter.vala |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/vala/valacodewriter.vala b/vala/valacodewriter.vala
index b442bb2..4535f88 100644
--- a/vala/valacodewriter.vala
+++ b/vala/valacodewriter.vala
@@ -562,6 +562,11 @@ public class Vala.CodeWriter : CodeVisitor {
 
                write_indent ();
                write_accessibility (c);
+
+               if (c.hides) {
+                       write_string ("new ");
+               }
+
                write_string ("const ");
 
                write_type (c.type_reference);
@@ -595,6 +600,10 @@ public class Vala.CodeWriter : CodeVisitor {
                write_indent ();
                write_accessibility (f);
 
+               if (f.hides) {
+                       write_string ("new ");
+               }
+
                if (f.binding == MemberBinding.STATIC) {
                        write_string ("static ");
                } else if (f.binding == MemberBinding.CLASS) {
@@ -770,6 +779,10 @@ public class Vala.CodeWriter : CodeVisitor {
                        }
                        write_string (" ");
                } else {
+                       if (m.hides) {
+                               write_string ("new ");
+                       }
+
                        if (m.binding == MemberBinding.STATIC) {
                                write_string ("static ");
                        } else if (m.binding == MemberBinding.CLASS) {
@@ -782,10 +795,6 @@ public class Vala.CodeWriter : CodeVisitor {
                                write_string ("override ");
                        }
 
-                       if (m.hides) {
-                               write_string ("new ");
-                       }
-
                        if (m.coroutine) {
                                write_string ("async ");
                        }
@@ -827,6 +836,10 @@ public class Vala.CodeWriter : CodeVisitor {
                write_indent ();
                write_accessibility (prop);
 
+               if (prop.hides) {
+                       write_string ("new ");
+               }
+
                if (prop.binding == MemberBinding.STATIC) {
                        write_string ("static ");
                } else  if (prop.is_abstract) {
@@ -889,6 +902,10 @@ public class Vala.CodeWriter : CodeVisitor {
                write_indent ();
                write_accessibility (sig);
 
+               if (sig.hides) {
+                       write_string ("new ");
+               }
+
                if (sig.is_virtual) {
                        write_string ("virtual ");
                }


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