From: Rico Tzschichholz Date: Thu, 14 Dec 2017 18:45:51 +0000 (+0100) Subject: vala: Move next_lambda_id into LambdaExpression X-Git-Tag: 0.39.3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abdb6f026c72f8bbbedd572f07450c67e628880a;p=thirdparty%2Fvala.git vala: Move next_lambda_id into LambdaExpression --- diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala index d194eca6f..a3ee20a2f 100644 --- a/vala/valalambdaexpression.vala +++ b/vala/valalambdaexpression.vala @@ -27,6 +27,8 @@ using GLib; * anonymous methods with implicitly typed parameters. */ public class Vala.LambdaExpression : Expression { + private static int next_lambda_id = 0; + /** * The expression body of this lambda expression. Only one of * expression_body or statement_body may be set. @@ -111,14 +113,6 @@ public class Vala.LambdaExpression : Expression { return false; } - string get_lambda_name (CodeContext context) { - var result = "_lambda%d_".printf (context.analyzer.next_lambda_id); - - context.analyzer.next_lambda_id++; - - return result; - } - public override bool check (CodeContext context) { if (checked) { return !error; @@ -138,7 +132,7 @@ public class Vala.LambdaExpression : Expression { var cb = (Delegate) ((DelegateType) target_type).delegate_symbol; var return_type = cb.return_type.get_actual_type (target_type, null, this); - method = new Method (get_lambda_name (context), return_type, source_reference); + method = new Method ("_lambda%d_".printf (next_lambda_id++), return_type, source_reference); // track usage for flow analyzer method.used = true; method.version.check (source_reference); diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala index 9bf704594..5424d7fd0 100644 --- a/vala/valasemanticanalyzer.vala +++ b/vala/valasemanticanalyzer.vala @@ -163,8 +163,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor { public DataType error_type; public Class gsource_type; - public int next_lambda_id = 0; - // keep replaced alive to make sure they remain valid // for the whole execution of CodeNode.accept public List replaced_nodes = new ArrayList ();