public virtual statement mk_return(type ty, Method m) { if (m.Type == T.Void) { return(new empty_statement()); } expression expr = null; if (m.Type.FullName == "char") { expr = new character_literal(new InputElement("'\0'")); } else if (m.Type.IsNumeric && m.Type != T.Decimal) { expr = new integer_literal(new InputElement("0")); } else if (m.Type.IsReferenceType) { expr = new null_literal(new InputElement("null")); } else if (m.Type.IsValueType) { expr = new new_expression(ty, argumentList.New()); } statement stmt = new return_statement(expr); stmt.method = m; return(stmt); }
public virtual void return_statement(return_statement ast) { if (ast.expr != null) { ast.expr = expression(ast.expr); } ast.exitstry = exitstry(ast, null); }
virtual public void return_statement(return_statement ast, int indent) { // Write("return", indent); // if (ast.expr != null) { // Write(" "); // visit(ast.expr); // } // WriteLine(";"); }
virtual public void return_statement(return_statement ast, int indent) { Write("return", indent); if (ast.expr != null) { Write(" "); visit(ast.expr); } Semicolon(indent); }