]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add CallableExpression interface for MethodCall/ObjectCreationExpression
authorRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Jan 2021 12:03:17 +0000 (13:03 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 26 Jan 2021 13:25:36 +0000 (14:25 +0100)
vala/Makefile.am
vala/valacallableexpression.vala [new file with mode: 0644]
vala/valamethodcall.vala
vala/valaobjectcreationexpression.vala

index 8a9badd4c1536fb1215a19d6e08123af89d2a142..542c24f4d9936d91d428e21f10755f7f30cca0b3 100644 (file)
@@ -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 (file)
index 0000000..9439cd2
--- /dev/null
@@ -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 ();
+}
index db6b6e2ab08e93f1ca4651aea3cc301d99381190..3a7325e8b891c3e1b7fc8e13ea827bd6665a704e 100644 (file)
@@ -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.
         */
index 54c42153699a9a98bafa449a4ce2fb02a4157948..62e7b105ee9b39118cb5f5599d5dee7d45ffef5b 100644 (file)
@@ -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.
         */