void AppendParameterList(StringBuilder result, CodeGenerationOptions options, IList <IParameter> parameters)
        {
            for (int i = 0; i < parameters.Count; i++)
            {
                if (i > 0)
                {
                    result.Append(", ");
                }

                var p = parameters[i];
                if (p.IsOut)
                {
                    result.Append("out ");
                }
                if (p.IsRef)
                {
                    result.Append("ref ");
                }
                if (p.IsParams)
                {
                    result.Append("params ");
                }
                AppendReturnType(result, options, p.Type);
                result.Append(" ");
                result.Append(CSharpAmbience.FilterName(p.Name));
                if (p.ConstantValue != null)
                {
                    result.Append(" = ");
                    if (p.Type.Kind == TypeKind.Enum)
                    {
                        bool found = false;
                        foreach (var literal in GetEnumLiterals(p.Type))
                        {
                            if (literal.ConstantValue.Equals(p.ConstantValue))
                            {
                                AppendReturnType(result, options, p.Type);
                                result.Append("." + literal.Name);
                                found = true;
                                break;
                            }
                        }
                        if (!found)
                        {
                            result.Append("(");
                            AppendReturnType(result, options, p.Type);
                            result.Append(")" + p.ConstantValue);
                        }
                    }
                    else if (p.ConstantValue is char)
                    {
                        result.Append("'" + p.ConstantValue + "'");
                    }
                    else if (p.ConstantValue is string)
                    {
                        result.Append("\"" + CSharpTextEditorIndentation.ConvertToStringLiteral((string)p.ConstantValue) + "\"");
                    }
                    else if (p.ConstantValue is bool)
                    {
                        result.Append((bool)p.ConstantValue ? "true" : "false");
                    }
                    else
                    {
                        result.Append(p.ConstantValue);
                    }
                }
            }
        }
        //		class ThrowsExceptionVisitor : DepthFirstAstVisitor
        //		{
        //			public bool Throws = false;
        //
        //			public override void VisitBlockStatement (BlockStatement blockStatement)
        //			{
        //				if (blockStatement.Statements.Count == 1 && blockStatement.Statements.First () is ThrowStatement)
        //					Throws = true;
        //			}
        //		}

        static void AppendParameterList(StringBuilder result, CodeGenerationOptions options, IList <IParameterSymbol> parameters, bool asParameterList)
        {
            for (int i = 0; i < parameters.Count; i++)
            {
                if (i > 0)
                {
                    result.Append(", ");
                }

                var p = parameters [i];
                if (p.RefKind == RefKind.Out)
                {
                    result.Append("out ");
                }
                if (p.RefKind == RefKind.Ref)
                {
                    result.Append("ref ");
                }
                if (asParameterList)
                {
                    if (p.IsParams)
                    {
                        result.Append("params ");
                    }
                    AppendReturnType(result, options, p.Type);
                    result.Append(" ");
                }
                result.Append(CSharpAmbience.FilterName(p.Name));
                if (p.HasExplicitDefaultValue)
                {
                    result.Append(" = ");
                    if (p.ExplicitDefaultValue is Enum)
                    {
                        var name = Enum.GetName(p.ExplicitDefaultValue.GetType(), p.ExplicitDefaultValue);
                        if (name != null)
                        {
                            AppendReturnType(result, options, p.Type);
                            result.Append("." + name);
                        }
                        else
                        {
                            result.Append("(");
                            AppendReturnType(result, options, p.Type);
                            result.Append(")" + p.ExplicitDefaultValue);
                        }
                    }
                    else if (p.ExplicitDefaultValue is char)
                    {
                        result.Append("'" + p.ExplicitDefaultValue + "'");
                    }
                    else if (p.ExplicitDefaultValue is string)
                    {
                        result.Append("\"" + CSharpTextEditorIndentation.ConvertToStringLiteral((string)p.ExplicitDefaultValue) + "\"");
                    }
                    else if (p.ExplicitDefaultValue is bool)
                    {
                        result.Append((bool)p.ExplicitDefaultValue ? "true" : "false");
                    }
                    else
                    {
                        result.Append(p.ExplicitDefaultValue);
                    }
                }
            }
        }