[vala/staging] vala: Don't process initializer of parameter if error is set
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Don't process initializer of parameter if error is set
- Date: Tue, 18 Feb 2020 16:27:36 +0000 (UTC)
commit 27fc5a83788c29a684241dd424dcb179e78b5e49
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Tue Feb 18 16:20:42 2020 +0100
vala: Don't process initializer of parameter if error is set
This caused criticals like:
vala_data_type_compatible: assertion 'self != NULL' failed
vala_code_node_to_string: assertion 'self != NULL' failed
tests/Makefile.am | 1 +
tests/semantic/parameter-default-invalid.test | 7 +++++++
vala/valaparameter.vala | 2 +-
3 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 69456f5bd..98c5e5faf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -823,6 +823,7 @@ TESTS = \
semantic/objectcreation-non-public-constructor.test \
semantic/objectcreation-unsupported-type.test \
semantic/parameter-accessibility.test \
+ semantic/parameter-default-invalid.test \
semantic/parameter-default-type.test \
semantic/parameter-out-default.test \
semantic/parameter-params.test \
diff --git a/tests/semantic/parameter-default-invalid.test b/tests/semantic/parameter-default-invalid.test
new file mode 100644
index 000000000..987bc376c
--- /dev/null
+++ b/tests/semantic/parameter-default-invalid.test
@@ -0,0 +1,7 @@
+Invalid Code
+
+void foo (int bar = G) {
+}
+
+void main () {
+}
diff --git a/vala/valaparameter.vala b/vala/valaparameter.vala
index e447612d3..052b06ce8 100644
--- a/vala/valaparameter.vala
+++ b/vala/valaparameter.vala
@@ -176,7 +176,7 @@ public class Vala.Parameter : Variable {
}
}
- if (initializer != null) {
+ if (initializer != null && !initializer.error) {
if (initializer is NullLiteral
&& !variable_type.nullable
&& direction != ParameterDirection.OUT) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]