summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLorenz Wildberg <lorenz@wild-fisch.de>2023-04-11 22:02:51 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2023-04-11 22:04:57 +0200
commit5abae64280233454d784c46e0d32804d05ad2aeb (patch)
tree6fa175882b2716d95b72d6855ec52a417e86fcd9
parent64d156751cb36c6f13893f6bdfb12a70935d91a0 (diff)
downloadvala-5abae64280233454d784c46e0d32804d05ad2aeb.tar.gz
vala: Improve check of type_referene in ObjectCreationExpression
-rw-r--r--vala/valaobjectcreationexpression.vala26
1 files changed, 12 insertions, 14 deletions
diff --git a/vala/valaobjectcreationexpression.vala b/vala/valaobjectcreationexpression.vala
index 5793b46f1..619f2770b 100644
--- a/vala/valaobjectcreationexpression.vala
+++ b/vala/valaobjectcreationexpression.vala
@@ -248,6 +248,18 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
type_reference.add_type_argument (type_arg);
}
+ if (!type_reference.check (context)) {
+ error = true;
+ return false;
+ }
+
+ context.analyzer.check_type (type_reference);
+ // check whether there is the expected amount of type-arguments
+ if (!type_reference.check_type_arguments (context)) {
+ error = true;
+ return false;
+ }
+
value_type = type_reference.copy ();
value_type.value_owned = true;
@@ -325,12 +337,6 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
}
}
- // check whether there is the expected amount of type-arguments
- if (!type_reference.check_type_arguments (context)) {
- error = true;
- return false;
- }
-
if (symbol_reference == null && argument_list.size != 0) {
value_type = null;
error = true;
@@ -432,10 +438,6 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
context.analyzer.check_arguments (this, new MethodType (m), m.get_parameters (), argument_list);
} else if (type_reference is ErrorType) {
- if (type_reference != null) {
- type_reference.check (context);
- }
-
if (member_name != null) {
member_name.check (context);
}
@@ -487,10 +489,6 @@ public class Vala.ObjectCreationExpression : Expression, CallableExpression {
}
}
- if (!type.external_package) {
- context.analyzer.check_type (type_reference);
- }
-
// Unwrap chained member initializers
foreach (MemberInitializer init in get_object_initializer ()) {
if (!(init.initializer is MemberInitializer)) {