[vala/staging] codegenerator: Add source_reference parameter to CodeGenerator.store_*()
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] codegenerator: Add source_reference parameter to CodeGenerator.store_*()
- Date: Mon, 19 Jun 2017 18:37:55 +0000 (UTC)
commit 7b582748a55cfbed247822047595081be98556f1
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Mon Jun 19 14:43:14 2017 +0200
codegenerator: Add source_reference parameter to CodeGenerator.store_*()
codegen/valaccodeassignmentmodule.vala | 16 ++++++++--------
codegen/valaccodebasemodule.vala | 8 ++++----
codegen/valaccodemethodcallmodule.vala | 2 +-
vala/valaassignment.vala | 6 +++---
vala/valacodegenerator.vala | 6 +++---
5 files changed, 19 insertions(+), 19 deletions(-)
---
diff --git a/codegen/valaccodeassignmentmodule.vala b/codegen/valaccodeassignmentmodule.vala
index 76004f7..718cd71 100644
--- a/codegen/valaccodeassignmentmodule.vala
+++ b/codegen/valaccodeassignmentmodule.vala
@@ -37,7 +37,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
}
if (assignment.operator == AssignmentOperator.SIMPLE) {
- store_value (assignment.left.target_value, assignment.right.target_value);
+ store_value (assignment.left.target_value, assignment.right.target_value,
assignment.source_reference);
} else {
CCodeAssignmentOperator cop;
if (assignment.operator == AssignmentOperator.BITWISE_OR) {
@@ -94,7 +94,7 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
}
}
- public override void store_value (TargetValue lvalue, TargetValue value) {
+ public override void store_value (TargetValue lvalue, TargetValue value, SourceReference?
source_reference = null) {
var array_type = lvalue.value_type as ArrayType;
if (array_type != null && array_type.fixed_length) {
@@ -162,16 +162,16 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
}
}
- public override void store_local (LocalVariable local, TargetValue value, bool initializer) {
+ public override void store_local (LocalVariable local, TargetValue value, bool initializer,
SourceReference? source_reference = null) {
if (!initializer && requires_destroy (local.variable_type)) {
/* unref old value */
ccode.add_expression (destroy_local (local));
}
- store_value (get_local_cvalue (local), value);
+ store_value (get_local_cvalue (local), value, source_reference);
}
- public override void store_parameter (Parameter param, TargetValue _value, bool capturing_parameter =
false) {
+ public override void store_parameter (Parameter param, TargetValue _value, bool capturing_parameter =
false, SourceReference? source_reference = null) {
var value = _value;
bool capturing_parameter_in_coroutine = capturing_parameter && is_in_coroutine ();
@@ -205,10 +205,10 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
ccode.add_expression (destroy_parameter (param));
}
- store_value (get_parameter_cvalue (param), value);
+ store_value (get_parameter_cvalue (param), value, source_reference);
}
- public override void store_field (Field field, TargetValue? instance, TargetValue value) {
+ public override void store_field (Field field, TargetValue? instance, TargetValue value,
SourceReference? source_reference = null) {
var lvalue = get_field_cvalue (field, instance);
var type = lvalue.value_type;
if (lvalue.actual_value_type != null) {
@@ -219,6 +219,6 @@ public class Vala.CCodeAssignmentModule : CCodeMemberAccessModule {
ccode.add_expression (destroy_field (field, instance));
}
- store_value (lvalue, value);
+ store_value (lvalue, value, source_reference);
}
}
diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala
index 1c3bdee..8d3469e 100644
--- a/codegen/valaccodebasemodule.vala
+++ b/codegen/valaccodebasemodule.vala
@@ -2504,7 +2504,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
*/
public TargetValue store_temp_value (TargetValue initializer, CodeNode node_reference, bool?
value_owned = null) {
var lvalue = create_temp_value (initializer.value_type, false, node_reference, value_owned);
- store_value (lvalue, initializer);
+ store_value (lvalue, initializer, node_reference.source_reference);
return load_temp_value (lvalue);
}
@@ -4023,7 +4023,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
public abstract TargetValue load_this_parameter (TypeSymbol sym);
- public abstract void store_value (TargetValue lvalue, TargetValue value);
+ public abstract void store_value (TargetValue lvalue, TargetValue value, SourceReference?
source_reference = null);
public virtual string get_delegate_target_cname (string delegate_cname) {
assert_not_reached ();
@@ -4223,7 +4223,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
ccode.add_else ();
// g_value_init/copy must not be called for uninitialized values
- store_value (temp_value, value);
+ store_value (temp_value, value, node.source_reference);
ccode.close ();
} else {
ccode.add_expression (copy_call);
@@ -5707,7 +5707,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
} else {
var temp_value = create_temp_value (type, false, node);
temp_ref_values.insert (0, ((GLibValue) temp_value).copy ());
- store_value (temp_value, result);
+ store_value (temp_value, result, node.source_reference);
result.cvalue = get_cvalue_ (temp_value);
}
}
diff --git a/codegen/valaccodemethodcallmodule.vala b/codegen/valaccodemethodcallmodule.vala
index 69d6802..67a54c9 100644
--- a/codegen/valaccodemethodcallmodule.vala
+++ b/codegen/valaccodemethodcallmodule.vala
@@ -839,7 +839,7 @@ public class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
}
// assign new value
- store_value (unary.inner.target_value, transform_value (unary.target_value,
unary.inner.value_type, arg));
+ store_value (unary.inner.target_value, transform_value (unary.target_value,
unary.inner.value_type, arg), expr.source_reference);
// handle out null terminated arrays
if (param != null && get_ccode_array_null_terminated (param)) {
diff --git a/vala/valaassignment.vala b/vala/valaassignment.vala
index 88e45ff..64b2395 100644
--- a/vala/valaassignment.vala
+++ b/vala/valaassignment.vala
@@ -495,11 +495,11 @@ public class Vala.Assignment : Expression {
var new_value = right.target_value;
if (local != null) {
- codegen.store_local (local, new_value, false);
+ codegen.store_local (local, new_value, false, source_reference);
} else if (param != null) {
- codegen.store_parameter (param, new_value);
+ codegen.store_parameter (param, new_value, false, source_reference);
} else if (field != null) {
- codegen.store_field (field, instance && ma.inner != null ?
ma.inner.target_value : null, new_value);
+ codegen.store_field (field, instance && ma.inner != null ?
ma.inner.target_value : null, new_value, source_reference);
}
if (!(parent_node is ExpressionStatement)) {
diff --git a/vala/valacodegenerator.vala b/vala/valacodegenerator.vala
index 9887a49..cea0db8 100644
--- a/vala/valacodegenerator.vala
+++ b/vala/valacodegenerator.vala
@@ -34,13 +34,13 @@ public abstract class Vala.CodeGenerator : CodeVisitor {
public abstract TargetValue load_local (LocalVariable local);
- public abstract void store_local (LocalVariable local, TargetValue value, bool initializer);
+ public abstract void store_local (LocalVariable local, TargetValue value, bool initializer,
SourceReference? source_reference = null);
public abstract TargetValue load_parameter (Parameter param);
- public abstract void store_parameter (Parameter param, TargetValue value, bool capturing_parameter =
false);
+ public abstract void store_parameter (Parameter param, TargetValue value, bool capturing_parameter =
false, SourceReference? source_reference = null);
public abstract TargetValue load_field (Field field, TargetValue? instance);
- public abstract void store_field (Field field, TargetValue? instance, TargetValue value);
+ public abstract void store_field (Field field, TargetValue? instance, TargetValue value,
SourceReference? source_reference = null);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]