[vala/staging] ccode: Minor API cleaning and additions



commit 2df469dfc7619aaa31319f150af453e577665597
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Mon Feb 1 14:54:55 2021 +0100

    ccode: Minor API cleaning and additions

 ccode/valaccodecommaexpression.vala    | 2 +-
 ccode/valaccodedeclaration.vala        | 9 +++++++++
 ccode/valaccodedeclarator.vala         | 5 +++++
 ccode/valaccodefragment.vala           | 4 ++--
 ccode/valaccodefunctioncall.vala       | 4 ++--
 ccode/valaccodefunctiondeclarator.vala | 5 -----
 ccode/valaccodevariabledeclarator.vala | 5 -----
 7 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/ccode/valaccodecommaexpression.vala b/ccode/valaccodecommaexpression.vala
index f72a98713..3221788ed 100644
--- a/ccode/valaccodecommaexpression.vala
+++ b/ccode/valaccodecommaexpression.vala
@@ -41,7 +41,7 @@ public class Vala.CCodeCommaExpression : CCodeExpression {
                inner[index] = expr;
        }
 
-       public List<CCodeExpression> get_inner () {
+       public unowned List<CCodeExpression> get_inner () {
                return inner;
        }
 
diff --git a/ccode/valaccodedeclaration.vala b/ccode/valaccodedeclaration.vala
index 6295477b3..6da01cfa6 100644
--- a/ccode/valaccodedeclaration.vala
+++ b/ccode/valaccodedeclaration.vala
@@ -46,6 +46,15 @@ public class Vala.CCodeDeclaration : CCodeStatement {
                declarators.add (decl);
        }
 
+       /**
+        * Returns the list of declarators.
+        *
+        * @return declarators list
+        */
+       public unowned List<CCodeDeclarator> get_declarators () {
+               return declarators;
+       }
+
        public override void write (CCodeWriter writer) {
                if ((modifiers & (CCodeModifiers.STATIC | CCodeModifiers.INTERNAL | CCodeModifiers.EXTERN)) 
== 0) {
                        foreach (CCodeDeclarator decl in declarators) {
diff --git a/ccode/valaccodedeclarator.vala b/ccode/valaccodedeclarator.vala
index 548469475..634dbb856 100644
--- a/ccode/valaccodedeclarator.vala
+++ b/ccode/valaccodedeclarator.vala
@@ -26,6 +26,11 @@ using GLib;
  * Represents a variable or function pointer declarator in the C code.
  */
 public abstract class Vala.CCodeDeclarator : CCodeNode {
+       /**
+        * The declarator name.
+        */
+       public string name { get; set; }
+
        /**
         * Writes initialization statements for this declarator with the
         * specified C code writer if necessary.
diff --git a/ccode/valaccodefragment.vala b/ccode/valaccodefragment.vala
index 51538da6b..49d415307 100644
--- a/ccode/valaccodefragment.vala
+++ b/ccode/valaccodefragment.vala
@@ -38,11 +38,11 @@ public class Vala.CCodeFragment : CCodeNode {
        }
 
        /**
-        * Returns a copy of the list of children.
+        * Returns the list of children.
         *
         * @return children list
         */
-       public List<CCodeNode> get_children () {
+       public unowned List<CCodeNode> get_children () {
                return children;
        }
 
diff --git a/ccode/valaccodefunctioncall.vala b/ccode/valaccodefunctioncall.vala
index e4a8ec16d..1d2e364c0 100644
--- a/ccode/valaccodefunctioncall.vala
+++ b/ccode/valaccodefunctioncall.vala
@@ -51,11 +51,11 @@ public class Vala.CCodeFunctionCall : CCodeExpression {
        }
 
        /**
-        * Returns a copy of the list of arguments.
+        * Returns the list of arguments.
         *
         * @return list of arguments
         */
-       public List<CCodeExpression> get_arguments () {
+       public unowned List<CCodeExpression> get_arguments () {
                return arguments;
        }
 
diff --git a/ccode/valaccodefunctiondeclarator.vala b/ccode/valaccodefunctiondeclarator.vala
index e9d634411..2ba21e957 100644
--- a/ccode/valaccodefunctiondeclarator.vala
+++ b/ccode/valaccodefunctiondeclarator.vala
@@ -26,11 +26,6 @@ using GLib;
  * Represents a function pointer declarator in the C code.
  */
 public class Vala.CCodeFunctionDeclarator : CCodeDeclarator {
-       /**
-        * The declarator name.
-        */
-       public string name { get; set; }
-
        private List<CCodeParameter> parameters = new ArrayList<CCodeParameter> ();
 
        public CCodeFunctionDeclarator (string name) {
diff --git a/ccode/valaccodevariabledeclarator.vala b/ccode/valaccodevariabledeclarator.vala
index 17fa478a3..f39eff0ed 100644
--- a/ccode/valaccodevariabledeclarator.vala
+++ b/ccode/valaccodevariabledeclarator.vala
@@ -26,11 +26,6 @@ using GLib;
  * Represents a variable declarator in the C code.
  */
 public class Vala.CCodeVariableDeclarator : CCodeDeclarator {
-       /**
-        * The variable name.
-        */
-       public string name { get; set; }
-
        /**
         * The optional initializer expression.
         */


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