[vala/0.54] vala: Set more missing source references of CodeNode instances
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.54] vala: Set more missing source references of CodeNode instances
- Date: Tue, 19 Oct 2021 08:01:03 +0000 (UTC)
commit eac64ca4b2d49002893ca40deae44770d8fc7cf0
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Oct 17 09:15:58 2021 +0200
vala: Set more missing source references of CodeNode instances
vala/valaaddressofexpression.vala | 4 ++--
vala/valaassignment.vala | 2 +-
vala/valaenumvaluetype.vala | 4 ++--
vala/valaforeachstatement.vala | 2 +-
vala/valalambdaexpression.vala | 1 +
vala/valamemberaccess.vala | 6 +++++-
vala/valamethod.vala | 5 +++--
vala/valamethodcall.vala | 3 +++
vala/valasignal.vala | 2 +-
vala/valasignaltype.vala | 14 ++++++++------
vala/valasliceexpression.vala | 2 +-
11 files changed, 28 insertions(+), 17 deletions(-)
---
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 aa3ff0bb4..4107148b8 100644
--- a/vala/valaenumvaluetype.vala
+++ b/vala/valaenumvaluetype.vala
@@ -45,7 +45,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) {
@@ -54,7 +54,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..e0b70c069 100644
--- a/vala/valalambdaexpression.vala
+++ b/vala/valalambdaexpression.vala
@@ -264,6 +264,7 @@ public class Vala.LambdaExpression : Expression {
method.check (context);
value_type = new MethodType (method);
+ value_type.source_reference = source_reference;
value_type.value_owned = target_type.value_owned;
return !error;
diff --git a/vala/valamemberaccess.vala b/vala/valamemberaccess.vala
index ef4bc22d2..9120db250 100644
--- a/vala/valamemberaccess.vala
+++ b/vala/valamemberaccess.vala
@@ -458,7 +458,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 +947,13 @@ 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.source_reference = source_reference;
} else if (symbol_reference is Property) {
value_type = new PropertyPrototype ((Property) symbol_reference);
+ value_type.source_reference = source_reference;
} else {
error = true;
value_type = new InvalidType ();
@@ -1001,6 +1004,7 @@ public class Vala.MemberAccess : Expression {
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.source_reference = 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..2e393bd38 100644
--- a/vala/valamethod.vala
+++ b/vala/valamethod.vala
@@ -1244,11 +1244,12 @@ public class Vala.Method : Subroutine, Callable {
}
var callback_type = new DelegateType ((Delegate) glib_ns.scope.lookup ("AsyncReadyCallback"));
+ callback_type.source_reference = 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 +1276,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..5b5cb50e2 100644
--- a/vala/valamethodcall.vala
+++ b/vala/valamethodcall.vala
@@ -301,6 +301,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
return false;
}
call.value_type = new ObjectType (context.analyzer.object_type);
+ call.value_type.source_reference = source_reference;
mtype = call.value_type;
}
}
@@ -567,6 +568,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
}
}
dynamic_sig.handler.target_type = new DelegateType (dynamic_sig.get_delegate
(new ObjectType ((ObjectTypeSymbol) dynamic_sig.parent_symbol), this));
+ dynamic_sig.handler.target_type.source_reference = source_reference;
}
if (m != null && m.has_type_parameters ()) {
@@ -632,6 +634,7 @@ public class Vala.MethodCall : Expression, CallableExpression {
unowned MemberAccess ma = (MemberAccess) call;
if (ma.member_name == "end") {
mtype = new MethodType (m.get_end_method ());
+ mtype.source_reference = 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 c64cce4a2..89e1a0270 100644
--- a/vala/valasignaltype.vala
+++ b/vala/valasignaltype.vala
@@ -56,11 +56,13 @@ public class Vala.SignalType : CallableType {
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));
+ result.source_reference = 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);
+ type_arg.source_reference = source_reference;
type_arg.value_owned = true;
result.add_type_argument (type_arg);
}
@@ -72,11 +74,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 +86,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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]