[vala/staging] vala: Move next_lambda_id into LambdaExpression
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/staging] vala: Move next_lambda_id into LambdaExpression
- Date: Thu, 14 Dec 2017 19:44:44 +0000 (UTC)
commit e2d1584b39a1383435879182cf2de2518ecb3d46
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Thu Dec 14 19:45:51 2017 +0100
vala: Move next_lambda_id into LambdaExpression
vala/valalambdaexpression.vala | 12 +++---------
vala/valasemanticanalyzer.vala | 2 --
2 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/vala/valalambdaexpression.vala b/vala/valalambdaexpression.vala
index d194eca..a3ee20a 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 9bf7045..5424d7f 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<CodeNode> replaced_nodes = new ArrayList<CodeNode> ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]