Beispiel #1
0
    private static string MangleDefaultConstructorName(ES_TypeInfo *typeName, bool isStatic)
    {
        // Sample name: "struct.System.Numerics__Vector2"
        using var mangleChars = new StructPooledList <char> (CL_ClearMode.Auto);

        // The prefix.
        if (!isStatic)
        {
            mangleChars.AddRange("defaultConstructor!");
        }
        else
        {
            mangleChars.AddRange("defaultStaticConstructor!");
        }

        // The namespace.
        var namespaceName = typeName->Name.NamespaceName.Span;

        ES_Encodings.Identifier.GetChars(namespaceName, mangleChars.AddSpan(namespaceName.Length));

        // The mangled namespace separator.
        mangleChars.Add('_', 2);

        // The function name.
        var structName = typeName->Name.TypeName.Span;

        ES_Encodings.Identifier.GetChars(structName, mangleChars.AddSpan(structName.Length));

        return(mangleChars.Span.GetPooledString());
    }
Beispiel #2
0
    internal static string MangleMemberFunctionName([DisallowNull] ES_TypeInfo *owner, [DisallowNull] ES_FunctionData *func)
    {
        using var mangleChars = new StructPooledList <char> (CL_ClearMode.Auto);

        // The type name.
        mangleChars.AddRange(owner->Name.TypeNameString);

        // The mangled namespace separator.
        mangleChars.AddRange("__");

        // The function name.
        mangleChars.AddRange(func->Name.TypeNameString);

        return(mangleChars.Span.GetPooledString());
    }
Beispiel #3
0
    internal static string MangleGlobalFunctionName([DisallowNull] ES_FunctionData *func)
    {
        // Sample name: "System.Math__FMath.Sin"
        using var mangleChars = new StructPooledList <char> (CL_ClearMode.Auto);

        // The namespace.
        mangleChars.AddRange(func->Name.NamespaceNameString);

        // The mangled namespace separator.
        mangleChars.AddRange("__");

        // The function name.
        mangleChars.AddRange(func->Name.TypeNameString);

        return(mangleChars.Span.GetPooledString());
    }