Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape identifiers with forbidden characters #68

Closed
MSDN-WhiteKnight opened this issue Aug 7, 2021 · 0 comments
Closed

Escape identifiers with forbidden characters #68

MSDN-WhiteKnight opened this issue Aug 7, 2021 · 0 comments
Milestone

Comments

@MSDN-WhiteKnight
Copy link
Owner

MSDN-WhiteKnight commented Aug 7, 2021

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
@MSDN-WhiteKnight MSDN-WhiteKnight added this to the 2.5 milestone Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant