From: Rico Tzschichholz Date: Sun, 17 Oct 2021 07:15:58 +0000 (+0200) Subject: vala: Set more missing source references of CodeNode instances X-Git-Tag: 0.55.1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=516f2095ee47e51f68539eedb366eff9ca623835;p=thirdparty%2Fvala.git vala: Set more missing source references of CodeNode instances --- diff --git a/vala/valaaddressofexpression.vala b/vala/valaaddressofexpression.vala index d271d0cc4..ff542835b 100644 --- a/vala/valaaddressofexpression.vala +++ b/vala/valaaddressofexpression.vala @@ -109,9 +109,9 @@ public class Vala.AddressofExpression : Expression { } if (inner.value_type.is_reference_type_or_type_parameter ()) { - value_type = new PointerType (new PointerType (inner.value_type)); + value_type = new PointerType (new PointerType (inner.value_type), source_reference); } else { - value_type = new PointerType (inner.value_type); + value_type = new PointerType (inner.value_type, source_reference); } return !error; diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala index 8902aedf3..46f9445a4 100644 --- a/vala/valaassignment.vala +++ b/vala/valaassignment.vala @@ -235,7 +235,7 @@ public class Vala.Assignment : Expression { // FIXME: only do this if the backend doesn't support // the assignment natively - var old_value = new MemberAccess (ma.inner, ma.member_name); + var old_value = new MemberAccess (ma.inner, ma.member_name, source_reference); BinaryOperator bop; diff --git a/vala/valaenumvaluetype.vala b/vala/valaenumvaluetype.vala index 578813078..ba1881dbd 100644 --- a/vala/valaenumvaluetype.vala +++ b/vala/valaenumvaluetype.vala @@ -44,7 +44,7 @@ public class Vala.EnumValueType : ValueType { if (to_string_method == null) { var string_type = CodeContext.get ().analyzer.string_type.copy (); string_type.value_owned = false; - to_string_method = new Method ("to_string", string_type); + to_string_method = new Method ("to_string", string_type, source_reference); to_string_method.access = SymbolAccessibility.PUBLIC; to_string_method.is_extern = true; if (CodeContext.get ().profile == Profile.POSIX) { @@ -53,7 +53,7 @@ public class Vala.EnumValueType : ValueType { to_string_method.set_attribute_string ("CCode", "cheader_filename", "glib-object.h"); } to_string_method.owner = type_symbol.scope; - to_string_method.this_parameter = new Parameter ("this", copy ()); + to_string_method.this_parameter = new Parameter ("this", copy (), source_reference); to_string_method.scope.add (to_string_method.this_parameter.name, to_string_method.this_parameter); } return to_string_method; diff --git a/vala/valaforeachstatement.vala b/vala/valaforeachstatement.vala index d18de773e..3d8ce2ba9 100644 --- a/vala/valaforeachstatement.vala +++ b/vala/valaforeachstatement.vala @@ -405,7 +405,7 @@ public class Vala.ForeachStatement : Block { context.analyzer.current_symbol = old_symbol; - collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name)); + collection_variable = new LocalVariable (collection_type.copy (), "%s_collection".printf (variable_name), null, source_reference); add_local_variable (collection_variable); collection_variable.active = true; diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala index 054badac5..be33765f8 100644 --- a/vala/valalambdaexpression.vala +++ b/vala/valalambdaexpression.vala @@ -263,7 +263,7 @@ public class Vala.LambdaExpression : Expression { method.check (context); - value_type = new MethodType (method); + value_type = new MethodType (method, source_reference); value_type.value_owned = target_type.value_owned; return !error; diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala index a5432d614..5be3fa0da 100644 --- a/vala/valamemberaccess.vala +++ b/vala/valamemberaccess.vala @@ -418,8 +418,7 @@ public class Vala.MemberAccess : Expression { } if (inner is MemberAccess && inner.symbol_reference is TypeParameter) { - inner.value_type = new GenericType ((TypeParameter) inner.symbol_reference); - inner.value_type.source_reference = source_reference; + inner.value_type = new GenericType ((TypeParameter) inner.symbol_reference, source_reference); } if (symbol_reference == null && inner.value_type != null) { @@ -458,7 +457,7 @@ public class Vala.MemberAccess : Expression { } var m = new DynamicMethod (inner.value_type, member_name, ret_type, source_reference); m.invocation = invoc; - var err = new ErrorType (null, null); + var err = new ErrorType (null, null, m.source_reference); err.dynamic_error = true; m.add_error_type (err); m.access = SymbolAccessibility.PUBLIC; @@ -947,10 +946,11 @@ public class Vala.MemberAccess : Expression { // required when using instance methods as delegates in constants // TODO replace by MethodPrototype value_type = context.analyzer.get_value_type_for_symbol (symbol_reference, lvalue); + value_type.source_reference = source_reference; } else if (symbol_reference is Field) { - value_type = new FieldPrototype ((Field) symbol_reference); + value_type = new FieldPrototype ((Field) symbol_reference, source_reference); } else if (symbol_reference is Property) { - value_type = new PropertyPrototype ((Property) symbol_reference); + value_type = new PropertyPrototype ((Property) symbol_reference, source_reference); } else { error = true; value_type = new InvalidType (); @@ -1000,7 +1000,7 @@ public class Vala.MemberAccess : Expression { if (m != null && m.binding == MemberBinding.STATIC && m.parent_symbol is ObjectTypeSymbol && inner != null && inner.value_type == null && inner_ma.type_argument_list.size > 0) { // support static methods in generic classes - inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol); + inner.value_type = new ObjectType ((ObjectTypeSymbol) m.parent_symbol, source_reference); foreach (var type_argument in inner_ma.type_argument_list) { inner.value_type.add_type_argument (type_argument); diff --git a/vala/valamethod.vala b/vala/valamethod.vala index 9769efff9..2926a7ab7 100644 --- a/vala/valamethod.vala +++ b/vala/valamethod.vala @@ -1243,12 +1243,12 @@ public class Vala.Method : Subroutine, Callable { } } - var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback")); + var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"), source_reference); callback_type.nullable = true; callback_type.value_owned = true; callback_type.is_called_once = true; - var callback_param = new Parameter ("_callback_", callback_type); + var callback_param = new Parameter ("_callback_", callback_type, source_reference); callback_param.initializer = new NullLiteral (source_reference); callback_param.initializer.target_type = callback_type.copy (); callback_param.set_attribute_double ("CCode", "pos", -1); @@ -1275,7 +1275,7 @@ public class Vala.Method : Subroutine, Callable { var glib_ns = CodeContext.get ().root.scope.lookup ("GLib"); var result_type = new ObjectType ((ObjectTypeSymbol) glib_ns.scope.lookup ("AsyncResult")); - var result_param = new Parameter ("_res_", result_type); + var result_param = new Parameter ("_res_", result_type, source_reference); result_param.set_attribute_double ("CCode", "pos", get_attribute_double ("CCode", "async_result_pos", 0.1)); scope.add (null, result_param); async_end_parameters.add (result_param); diff --git a/vala/valamethodcall.vala b/vala/valamethodcall.vala index de05c9075..aff7db77a 100644 --- a/vala/valamethodcall.vala +++ b/vala/valamethodcall.vala @@ -300,7 +300,7 @@ public class Vala.MethodCall : Expression, CallableExpression { Report.error (source_reference, "chain up to `GLib.Object' not supported"); return false; } - call.value_type = new ObjectType (context.analyzer.object_type); + call.value_type = new ObjectType (context.analyzer.object_type, source_reference); mtype = call.value_type; } } @@ -566,7 +566,7 @@ public class Vala.MethodCall : Expression, CallableExpression { dynamic_sig.add_parameter (param.copy ()); } } - dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate (new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this)); + dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate (new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this), source_reference); } if (m != null && m.has_type_parameters ()) { @@ -631,7 +631,7 @@ public class Vala.MethodCall : Expression, CallableExpression { if (m != null && m.coroutine) { unowned MemberAccess ma = (MemberAccess) call; if (ma.member_name == "end") { - mtype = new MethodType (m.get_end_method ()); + mtype = new MethodType (m.get_end_method (), source_reference); } } } diff --git a/vala/valasignal.vala b/vala/valasignal.vala index 5c790a7cd..8e805d682 100644 --- a/vala/valasignal.vala +++ b/vala/valasignal.vala @@ -104,7 +104,7 @@ public class Vala.Signal : Symbol, Callable { public Delegate get_delegate (DataType sender_type, CodeNode node_reference) { var actual_return_type = return_type.get_actual_type (sender_type, null, node_reference); - var generated_delegate = new Delegate (null, actual_return_type); + var generated_delegate = new Delegate (null, actual_return_type, source_reference); generated_delegate.access = SymbolAccessibility.PUBLIC; generated_delegate.owner = scope; diff --git a/vala/valasignaltype.vala b/vala/valasignaltype.vala index 9de2558e2..ca90186fc 100644 --- a/vala/valasignaltype.vala +++ b/vala/valasignaltype.vala @@ -55,12 +55,12 @@ public class Vala.SignalType : CallableType { public DelegateType get_handler_type () { var type_sym = (ObjectTypeSymbol) signal_symbol.parent_symbol; var sender_type = SemanticAnalyzer.get_data_type_for_symbol (type_sym); - var result = new DelegateType (signal_symbol.get_delegate (sender_type, this)); + var result = new DelegateType (signal_symbol.get_delegate (sender_type, this), source_reference); result.value_owned = true; if (result.delegate_symbol.has_type_parameters ()) { foreach (var type_param in type_sym.get_type_parameters ()) { - var type_arg = new GenericType (type_param); + var type_arg = new GenericType (type_param, source_reference); type_arg.value_owned = true; result.add_type_argument (type_arg); } @@ -72,11 +72,11 @@ public class Vala.SignalType : CallableType { unowned Method get_connect_method () { if (connect_method == null) { var ulong_type = CodeContext.get ().analyzer.ulong_type.copy (); - connect_method = new Method ("connect", ulong_type); + connect_method = new Method ("connect", ulong_type, source_reference); connect_method.access = SymbolAccessibility.PUBLIC; connect_method.external = true; connect_method.owner = signal_symbol.scope; - connect_method.add_parameter (new Parameter ("handler", get_handler_type ())); + connect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference)); } return connect_method; } @@ -84,22 +84,22 @@ public class Vala.SignalType : CallableType { unowned Method get_connect_after_method () { if (connect_after_method == null) { var ulong_type = CodeContext.get ().analyzer.ulong_type.copy (); - connect_after_method = new Method ("connect_after", ulong_type); + connect_after_method = new Method ("connect_after", ulong_type, source_reference); connect_after_method.access = SymbolAccessibility.PUBLIC; connect_after_method.external = true; connect_after_method.owner = signal_symbol.scope; - connect_after_method.add_parameter (new Parameter ("handler", get_handler_type ())); + connect_after_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference)); } return connect_after_method; } unowned Method get_disconnect_method () { if (disconnect_method == null) { - disconnect_method = new Method ("disconnect", new VoidType ()); + disconnect_method = new Method ("disconnect", new VoidType (), source_reference); disconnect_method.access = SymbolAccessibility.PUBLIC; disconnect_method.external = true; disconnect_method.owner = signal_symbol.scope; - disconnect_method.add_parameter (new Parameter ("handler", get_handler_type ())); + disconnect_method.add_parameter (new Parameter ("handler", get_handler_type (), source_reference)); } return disconnect_method; } diff --git a/vala/valasliceexpression.vala b/vala/valasliceexpression.vala index 98b009b5e..42c056c1e 100644 --- a/vala/valasliceexpression.vala +++ b/vala/valasliceexpression.vala @@ -178,7 +178,7 @@ public class Vala.SliceExpression : Expression { } else { var slice_method = container.value_type.get_member ("slice") as Method; if (slice_method != null) { - var slice_call = new MethodCall (new MemberAccess (container, "slice")); + var slice_call = new MethodCall (new MemberAccess (container, "slice", source_reference), source_reference); slice_call.add_argument (start); slice_call.add_argument (stop); slice_call.target_type = this.target_type;