]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
vala: Improve check of type_referene in ObjectCreationExpression
authorLorenz Wildberg <lorenz@wild-fisch.de>
Tue, 11 Apr 2023 20:02:51 +0000 (22:02 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Tue, 11 Apr 2023 20:04:57 +0000 (22:04 +0200)
vala/valaobjectcreationexpression.vala

index 5793b46f15efb6ac7eb418f8250d6f995ad7c3c4..619f2770b244121c3175c65fa3eb0b05ccc5a0a9 100644 (file)
@@ -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)) {