2007-09-17 Jürg Billeter <j@bitron.ch>
+ * vala/valacodevisitor.vala, vala/valamemorymanager.vala,
+ vala/valareturnstatement.vala, vala/valasemanticanalyzer.vala,
+ vala/valasymbolresolver.vala, gobject/valacodegenerator.vala: switch
+ return statement to external visitor
+
+2007-09-17 Jürg Billeter <j@bitron.ch>
+
* vala/valablock.vala, vala/valacodevisitor.vala,
vala/valaforeachstatement.vala, vala/valamemorymanager.vala,
vala/valasemanticanalyzer.vala, vala/valaswitchsection.vala,
expr.temp_vars.add (return_expr_decl);
}
- public override void visit_begin_return_statement (ReturnStatement! stmt) {
+ public override void visit_return_statement (ReturnStatement! stmt) {
if (stmt.return_expression != null) {
// avoid unnecessary ref/unref pair
if (stmt.return_expression.ref_missing &&
}
}
}
- }
- public override void visit_end_return_statement (ReturnStatement! stmt) {
+ stmt.accept_children (this);
+
if (stmt.return_expression == null) {
stmt.ccodenode = new CCodeReturnStatement ();
}
/**
- * Visit operation called at beginning of return statements.
+ * Visit operation called for return statements.
*
* @param stmt a return statement
*/
- public virtual void visit_begin_return_statement (ReturnStatement! stmt) {
- }
-
- /**
- * Visit operation called at end of return statements.
- *
- * @param stmt a return statement
- */
- public virtual void visit_end_return_statement (ReturnStatement! stmt) {
+ public virtual void visit_return_statement (ReturnStatement! stmt) {
}
/**
stmt.accept_children (this);
}
- public override void visit_end_return_statement (ReturnStatement! stmt) {
+ public override void visit_return_statement (ReturnStatement! stmt) {
+ stmt.accept_children (this);
+
if (stmt.return_expression != null) {
if (current_symbol is Method) {
var m = (Method) current_symbol;
* The optional expression to return.
*/
public Expression return_expression {
- get {
- return _return_expression;
- }
+ get { return _return_expression; }
set {
_return_expression = value;
if (_return_expression != null) {
/**
* Creates a new return statement.
*
- * @param result the return expression
- * @param source reference to source code
- * @return newly created return statement
+ * @param return_expression the return expression
+ * @param source_reference reference to source code
+ * @return newly created return statement
*/
- public ReturnStatement (Expression result = null, SourceReference source = null) {
- return_expression = result;
- source_reference = source;
+ public ReturnStatement (construct Expression return_expression = null, construct SourceReference source_reference = null) {
}
-
+
public override void accept (CodeVisitor! visitor) {
- visitor.visit_begin_return_statement (this);
+ visitor.visit_return_statement (this);
+ }
+ public override void accept_children (CodeVisitor! visitor) {
if (return_expression != null) {
return_expression.accept (visitor);
visitor.visit_end_full_expression (return_expression);
}
-
- visitor.visit_end_return_statement (this);
}
public override void replace (CodeNode! old_node, CodeNode! new_node) {
stmt.tree_can_fail = stmt.collection.tree_can_fail || stmt.body.tree_can_fail;
}
- public override void visit_end_return_statement (ReturnStatement! stmt) {
+ public override void visit_return_statement (ReturnStatement! stmt) {
+ stmt.accept_children (this);
+
if (stmt.return_expression != null && stmt.return_expression.error) {
// ignore inner error
stmt.error = true;
stmt.accept_children (this);
}
+ public override void visit_return_statement (ReturnStatement! stmt) {
+ stmt.accept_children (this);
+ }
+
public override void visit_throw_statement (ThrowStatement! stmt) {
stmt.accept_children (this);
}