]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Add InvalidExpression as replacement for erroneous nodes instead
authorRico Tzschichholz <ricotz@ubuntu.com>
Wed, 22 Apr 2020 20:33:53 +0000 (22:33 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 2 Jun 2020 10:15:03 +0000 (12:15 +0200)
This type is meant to be used where a successful parsing or transforming
cannot be achieved and the usage of "null" is not possible.

vala/Makefile.am
vala/valainvalidexpression.vala [new file with mode: 0644]

index 78e4c93909e7b23f166b9174ff780bffca153c51..c833939a3d4d31f54e90380be5a6b3e438ca4dd8 100644 (file)
@@ -102,6 +102,7 @@ libvala_la_VALASOURCES = \
        valaintegertype.vala \
        valainterface.vala \
        valainterfacetype.vala \
+       valainvalidexpression.vala \
        valainvalidtype.vala \
        valalambdaexpression.vala \
        valaliteral.vala \
diff --git a/vala/valainvalidexpression.vala b/vala/valainvalidexpression.vala
new file mode 100644 (file)
index 0000000..dc7d5e4
--- /dev/null
@@ -0,0 +1,38 @@
+/* valainvalidexpression.vala
+ *
+ * Copyright (C) 2020  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>
+ */
+
+/**
+ * An invalid expression.
+ */
+public class Vala.InvalidExpression : Expression {
+       public InvalidExpression () {
+               error = true;
+       }
+
+       public override bool is_pure () {
+               return false;
+       }
+
+       public override bool check (CodeContext context) {
+               return false;
+       }
+}