|
|
|
@ -2020,48 +2020,38 @@ namespace CppSharp.Generators.CSharp
@@ -2020,48 +2020,38 @@ namespace CppSharp.Generators.CSharp
|
|
|
|
|
throw new NotSupportedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public string GetFunctionIdentifier(Function function) |
|
|
|
|
public static string GetFunctionIdentifier(Function function) |
|
|
|
|
{ |
|
|
|
|
var printer = TypePrinter as CSharpTypePrinter; |
|
|
|
|
var isNativeContext = printer.ContextKind == CSharpTypePrinterContextKind.Native; |
|
|
|
|
var identifier = SafeIdentifier(function.Name); |
|
|
|
|
|
|
|
|
|
var method = function as Method; |
|
|
|
|
if (method == null || !method.IsOperator) |
|
|
|
|
return identifier; |
|
|
|
|
|
|
|
|
|
string identifier; |
|
|
|
|
bool isBuiltin; |
|
|
|
|
identifier = GetOperatorIdentifier(method.OperatorKind, out isBuiltin); |
|
|
|
|
|
|
|
|
|
return identifier; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static string GetFunctionNativeIdentifier(Function function) |
|
|
|
|
{ |
|
|
|
|
var identifier = SafeIdentifier(function.Name);; |
|
|
|
|
|
|
|
|
|
var method = function as Method; |
|
|
|
|
if (method != null && method.IsOperator) |
|
|
|
|
{ |
|
|
|
|
if (isNativeContext) |
|
|
|
|
identifier = "Operator" + method.OperatorKind.ToString(); |
|
|
|
|
else |
|
|
|
|
identifier = GetOperatorIdentifier(method.OperatorKind, out isBuiltin); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
identifier = SafeIdentifier(function.Name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var overloads = function.Namespace.GetFunctionOverloads(function).ToList(); |
|
|
|
|
var overloads = function.Namespace.GetFunctionOverloads(function) |
|
|
|
|
.ToList(); |
|
|
|
|
var index = overloads.IndexOf(function); |
|
|
|
|
|
|
|
|
|
if (isNativeContext && index >= 0) |
|
|
|
|
if (index >= 0) |
|
|
|
|
identifier += index.ToString(CultureInfo.InvariantCulture); |
|
|
|
|
|
|
|
|
|
return identifier; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public string GetFunctionNativeIdentifier(Function function) |
|
|
|
|
{ |
|
|
|
|
var typePrinter = TypePrinter as CSharpTypePrinter; |
|
|
|
|
typePrinter.PushContext(CSharpTypePrinterContextKind.Native); |
|
|
|
|
|
|
|
|
|
var name = GetFunctionIdentifier(function); |
|
|
|
|
|
|
|
|
|
typePrinter.PopContext(); |
|
|
|
|
|
|
|
|
|
return name; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void GenerateInternalFunction(Function function) |
|
|
|
|
{ |
|
|
|
|
if (!function.IsProcessed || function.ExplicityIgnored) |
|
|
|
|