MSDN-WhiteKnight / CilTools

A set of tools to work with CIL in .NET applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Don't escape math symbols in string literals

MSDN-WhiteKnight opened this issue · comments

https://github.com/MSDN-WhiteKnight/CilTools/blob/master/CilTools.BytecodeAnalysis/CilAnalysis.cs#L333

using System;
using System.Collections.Generic;
using System.Text;
using CilTools.BytecodeAnalysis;
using CilTools.BytecodeAnalysis.Extensions;
using CilTools.Syntax;

namespace NetCoreTest
{
    class Program
    {
        public static void Foo(int x, int y)
        {
            if (x > y) Console.WriteLine("x>y");
            else if (x == y) Console.WriteLine("x=y");
            else Console.WriteLine("x<y");
        }

        public static void Main(string[] args)
        {
            CilGraph graph = typeof(Program).GetMethod("Foo").GetCilGraph();
            MethodDefSyntax syntax = graph.ToSyntaxTree();
            Console.WriteLine(syntax.ToString());
            Console.ReadKey();
        }
    }
}

Current output:

ldstr        "x\076y"

Expected:

ldstr      "x>y"