summaryrefslogtreecommitdiff
path: root/codegen
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2023-04-06 15:14:52 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2023-04-06 16:11:37 +0200
commit8d7e4b7a1e5881dd5b93a99a1ec3ee8529d67f35 (patch)
treeaab61576077b16aa7726705b154acce7f23f383a /codegen
parent6ad0e233e6f67f5b30810203b43b160e4c529f37 (diff)
downloadvala-8d7e4b7a1e5881dd5b93a99a1ec3ee8529d67f35.tar.gz
codegen: Stabilize CCode.cname for backing method of lamdba expression
Move lambda_id generation to CCodeAttribute and use _vala_lambda%d_ pattern
Diffstat (limited to 'codegen')
-rw-r--r--codegen/valaccodeattribute.vala5
1 files changed, 5 insertions, 0 deletions
diff --git a/codegen/valaccodeattribute.vala b/codegen/valaccodeattribute.vala
index 74a366524..f47eb3b7c 100644
--- a/codegen/valaccodeattribute.vala
+++ b/codegen/valaccodeattribute.vala
@@ -25,6 +25,8 @@
* Cache for the CCode attribute
*/
public class Vala.CCodeAttribute : AttributeCache {
+ private static int next_lambda_id = 0;
+
private weak CodeNode node;
private weak Symbol? sym;
private Attribute ccode;
@@ -755,6 +757,9 @@ public class Vala.CCodeAttribute : AttributeCache {
return "_dynamic_%s%d".printf (sym.name, dynamic_method_id++);
} else if (sym is Method) {
unowned Method m = (Method) sym;
+ if (m.parent_node is LambdaExpression) {
+ return "_vala_lambda%d_".printf (next_lambda_id++);
+ }
if (m.is_async_callback) {
return "%s_co".printf (get_ccode_real_name ((Method) m.parent_symbol));
}