Exemplo n.º 1
0
        /// <nodoc />
        public static string ToDisplayString(this Node node, ImmutableContextBase context)
        {
            Contract.Requires(node != null);
            Contract.Requires(context != null);

            using (var writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture))
            {
                try
                {
                    return(PrettyPrinter.GetLogStringRepr(
                               context.FrontEndContext,
                               writer,
                               context.LastActiveUsedPath.GetParent(context.FrontEndContext.PathTable),
                               context.Package.Path.GetParent(context.FrontEndContext.PathTable),
                               node));
                }
                catch (NotImplementedException)
                {
                    // Some AST values have no implementation of visitor.
                    // TODO: Fix me!
                    return(I($"<ValueExpression:({node.Location.Line},{node.Location.Position})>"));
                }
            }
        }