[vala/staging] vala: Add CallableExpression interface for MethodCall/ObjectCreationExpression



commit 4f2b9d6668a7aae96e07aa2b25273b39688c6fd8
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Tue Jan 26 13:03:17 2021 +0100

    vala: Add CallableExpression interface for MethodCall/ObjectCreationExpression

 vala/Makefile.am                       |  1 +
 vala/valacallableexpression.vala       | 47 ++++++++++++++++++++++++++++++++++
 vala/valamethodcall.vala               |  2 +-
 vala/valaobjectcreationexpression.vala |  2 +-
 4 files changed, 50 insertions(+), 2 deletions(-)
---
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 8a9badd4c..542c24f4d 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -43,6 +43,7 @@ libvala_la_VALASOURCES = \
        valabooleantype.vala \
        valabreakstatement.vala \
        valacallable.vala \
+       valacallableexpression.vala \
        valacallabletype.vala \
        valacastexpression.vala \
        valacatchclause.vala \
diff --git a/vala/valacallableexpression.vala b/vala/valacallableexpression.vala
new file mode 100644
index 000000000..9439cd2a2
--- /dev/null
+++ b/vala/valacallableexpression.vala
@@ -0,0 +1,47 @@
+/* valacallableexpression.vala
+ *
+ * Copyright (C) 2021  Rico Tzschichholz
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ *     Rico Tzschichholz <ricotz ubuntu com>
+ */
+
+using GLib;
+
+/**
+ * Interface for all callable expressions.
+ */
+public interface Vala.CallableExpression : Expression {
+       /**
+        * Whether it is a stateful async invocation.
+        */
+       public abstract bool is_yield_expression { get; set; }
+
+       /**
+        * Appends the specified expression to the list of arguments.
+        *
+        * @param arg an argument
+        */
+       public abstract void add_argument (Expression arg);
+
+       /**
+        * Returns the argument list.
+        *
+        * @return argument list
+        */
+       public abstract unowned List<Expression> get_argument_list ();
+}
diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala
index db6b6e2ab..3a7325e8b 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents an invocation expression in the source code.
  */
-public class Vala.MethodCall : Expression {
+public class Vala.MethodCall : Expression, CallableExpression {
        /**
         * The method to call.
         */
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 54c421536..62e7b105e 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -25,7 +25,7 @@ using GLib;
 /**
  * Represents an object creation expression in the source code.
  */
-public class Vala.ObjectCreationExpression : Expression {
+public class Vala.ObjectCreationExpression : Expression, CallableExpression {
        /**
         * The object type to create.
         */


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