Escape identifiers with forbidden characters
MSDN-WhiteKnight opened this issue · comments
From ECMA 335 II.5 General syntax:
ID is a contiguous string of characters which starts with either an alphabetic character (A–Z, a–z) or
one of “_”, “$”, “@”, “`” (grave accent), or “?”, and is followed by any number of alphanumeric
characters (A–Z, a–z, 0–9) or the characters “_”, “$”, “@”, “`” (grave accent), and “?”....
Identifiers are used to name entities. Simple identifiers are equivalent to an ID. However, the ILAsm
syntax allows the use of any identifier that can be formed using the Unicode character set (see
Partition I). To achieve this, an identifier shall be placed within single quotation marks.
Example C++/CLI program:
using namespace System;
public class A {
int _x;
public: A(int x) { this->_x = x; }
};
int main(array<System::String ^> ^args)
{
A a(1);
Console::ReadKey();
return 0;
}
Expected disassembler output:
.method assembly static valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall)
'A.{ctor}'(valuetype A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) A_0,
int32 x) cil managed
Current output:
.method assembly static valuetype [CliTest]A* modopt([mscorlib]System.Runtime.CompilerServices.CallConvThiscall) A.{ctor}(
valuetype [CliTest]A* modopt([mscorlib]System.Runtime.CompilerServices.IsConst) modopt([mscorlib]System.Runtime.CompilerServices.IsConst) par0,
int32 x
) cil managed