Commit 251f0e7a authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

switch lambda expression to external visitor

2007-09-17  Juerg Billeter  <j@bitron.ch>

	* vala/valacodevisitor.vala, vala/valalambdaexpression.vala,
	  vala/valamemorymanager.vala, vala/valasemanticanalyzer.vala,
	  vala/valasymbolresolver.vala, gobject/valacodegenerator.vala: switch
	  lambda expression to external visitor

svn path=/trunk/; revision=616
parent bf34312b
2007-09-17 Jürg Billeter <j@bitron.ch>
* vala/valacodevisitor.vala, vala/valalambdaexpression.vala,
vala/valamemorymanager.vala, vala/valasemanticanalyzer.vala,
vala/valasymbolresolver.vala, gobject/valacodegenerator.vala: switch
lambda expression to external visitor
2007-09-17 Jürg Billeter <j@bitron.ch>
* vala/valacodevisitor.vala, vala/valamemorymanager.vala,
......
......@@ -2748,7 +2748,9 @@ public class Vala.CodeGenerator : CodeVisitor {
expr.ccodenode = new CCodeConditionalExpression ((CCodeExpression) expr.condition.ccodenode, (CCodeExpression) expr.true_expression.ccodenode, (CCodeExpression) expr.false_expression.ccodenode);
}
public override void visit_end_lambda_expression (LambdaExpression! l) {
public override void visit_lambda_expression (LambdaExpression! l) {
l.accept_children (this);
l.ccodenode = new CCodeIdentifier (l.method.get_cname ());
}
......
......@@ -588,19 +588,11 @@ public abstract class Vala.CodeVisitor : Object {
}
/**
* Visit operation called at beginning of lambda expressions.
* Visit operation called for lambda expressions.
*
* @param expr a lambda expression
*/
public virtual void visit_begin_lambda_expression (LambdaExpression! expr) {
}
/**
* Visit operation called at end of lambda expressions.
*
* @param expr a lambda expression
*/
public virtual void visit_end_lambda_expression (LambdaExpression! expr) {
public virtual void visit_lambda_expression (LambdaExpression! expr) {
}
/**
......
......@@ -86,8 +86,10 @@ public class Vala.LambdaExpression : Expression {
}
public override void accept (CodeVisitor! visitor) {
visitor.visit_begin_lambda_expression (this);
visitor.visit_lambda_expression (this);
}
public override void accept_children (CodeVisitor! visitor) {
if (method == null) {
if (expression_body != null) {
expression_body.accept (visitor);
......@@ -95,11 +97,7 @@ public class Vala.LambdaExpression : Expression {
} else if (statement_body != null) {
statement_body.accept (visitor);
}
}
visitor.visit_end_lambda_expression (this);
if (method != null) {
} else {
method.accept (visitor);
}
}
......
......@@ -286,6 +286,10 @@ public class Vala.MemoryManager : CodeVisitor {
visit_possibly_leaked_expression (expr.right);
}
public override void visit_lambda_expression (LambdaExpression! l) {
l.accept_children (this);
}
public override void visit_assignment (Assignment! a) {
a.accept_children (this);
......
......@@ -2515,7 +2515,7 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
return false;
}
public override void visit_begin_lambda_expression (LambdaExpression! l) {
public override void visit_lambda_expression (LambdaExpression! l) {
if (l.expected_type == null || !(l.expected_type.data_type is Callback)) {
l.error = true;
Report.error (l.source_reference, "lambda expression not allowed in this context");
......@@ -2575,6 +2575,8 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
/* lambda expressions should be usable like MemberAccess of a method */
l.symbol_reference = l.method;
l.accept_children (this);
}
public override void visit_assignment (Assignment! a) {
......
......@@ -343,6 +343,10 @@ public class Vala.SymbolResolver : CodeVisitor {
expr.accept_children (this);
}
public override void visit_lambda_expression (LambdaExpression! l) {
l.accept_children (this);
}
public override void visit_assignment (Assignment! a) {
a.accept_children (this);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment