void AppendReturnType (StringBuilder result, CodeGenerationOptions options, IType type)
		{
			if (type == null)
				throw new ArgumentNullException ("type");
			var implementingType = options.Part;
			var loc = implementingType.Region.End;
			
			var pf = implementingType.UnresolvedFile;
			var file = pf as CSharpUnresolvedFile;
			var resolved = type;
			if (resolved.Kind == TypeKind.Unknown) {
				result.Append (type.FullName);
				return;
			}
			var def = type.GetDefinition ();
			if (def != null) {
				using (var stringWriter = new System.IO.StringWriter ()) {
					var formatter = new TextWriterOutputFormatter (stringWriter);
					stringWriter.NewLine = EolMarker; 
					var visitor = new CSharpOutputVisitor (formatter, FormattingOptionsFactory.CreateMono ());
					var shortType = CreateShortType (def.Compilation, file, loc, resolved);
					shortType.AcceptVisitor (visitor);
					
					var typeString = stringWriter.ToString ();
					if (typeString.StartsWith ("global::"))
						typeString = typeString.Substring ("global::".Length);
					result.Append (typeString);
				}
			} else {
				result.Append (new ICSharpCode.NRefactory.PlayScript.CSharpAmbience ().ConvertType (type));
			}
		}
		static string OutputNode (MonoDevelop.Ide.Gui.Document doc, AstNode node)
		{
			using (var stringWriter = new System.IO.StringWriter ()) {
//				formatter.Indentation = indentLevel;
				var formatter = new TextWriterOutputFormatter (stringWriter);
				stringWriter.NewLine = doc.Editor.EolMarker;
				
				var visitor = new CSharpOutputVisitor (formatter, doc.GetFormattingOptions ());
				node.AcceptVisitor (visitor);
				return stringWriter.ToString ();
			}
		}
		public static string PrintPrimitiveValue(object val)
		{
			StringWriter writer = new StringWriter();
			CSharpOutputVisitor visitor = new CSharpOutputVisitor(writer, new CSharpFormattingOptions());
			visitor.WritePrimitiveValue(val);
			return writer.ToString();
		}