summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2020-04-22 22:33:53 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2020-05-23 10:34:00 +0200
commitf1f776027ceb376b6faca17625799f6bd2ea66d2 (patch)
tree2d2386f1b6cdc53733d587611f3f3da19568fea0
parentf844ad1c02fb5b17e923a7ba4e69cf2a7df96a14 (diff)
downloadvala-f1f776027ceb376b6faca17625799f6bd2ea66d2.tar.gz
vala: Add InvalidExpression as replacement for erroneous nodes instead
This type is meant to be used where a successful parsing or transforming cannot be achieved and the usage of "null" is not possible.
-rw-r--r--vala/Makefile.am1
-rw-r--r--vala/valainvalidexpression.vala38
2 files changed, 39 insertions, 0 deletions
diff --git a/vala/Makefile.am b/vala/Makefile.am
index 78e4c9390..c833939a3 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -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
index 000000000..dc7d5e4f7
--- /dev/null
+++ b/vala/valainvalidexpression.vala
@@ -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;
+ }
+}