From 5abae64280233454d784c46e0d32804d05ad2aeb Mon Sep 17 00:00:00 2001 From: Lorenz Wildberg Date: Tue, 11 Apr 2023 22:02:51 +0200 Subject: vala: Improve check of type_referene in ObjectCreationExpression --- vala/valaobjectcreationexpression.vala | 26 ++++++++++++-------------- 1 file 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)) { -- cgit v1.2.1