You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
C# Modify the MemberName generated for the user script
This commit is contained in:
@@ -133,7 +133,9 @@ namespace Godot.SourceGenerators
|
||||
.Distinct(new MethodOverloadEqualityComparer())
|
||||
.ToArray();
|
||||
|
||||
source.Append(" private partial class GodotInternal {\n");
|
||||
source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n");
|
||||
|
||||
source.Append($" public new class MethodName : {symbol.BaseType.FullQualifiedName()}.MethodName {{\n");
|
||||
|
||||
// Generate cached StringNames for methods and properties, for fast lookup
|
||||
|
||||
@@ -144,7 +146,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
foreach (string methodName in distinctMethodNames)
|
||||
{
|
||||
source.Append(" public static readonly StringName MethodName_");
|
||||
source.Append(" public new static readonly StringName ");
|
||||
source.Append(methodName);
|
||||
source.Append(" = \"");
|
||||
source.Append(methodName);
|
||||
@@ -157,8 +159,6 @@ namespace Godot.SourceGenerators
|
||||
|
||||
if (godotClassMethods.Length > 0)
|
||||
{
|
||||
source.Append("#pragma warning disable CS0109 // Disable warning about redundant 'new' keyword\n");
|
||||
|
||||
const string listType = "System.Collections.Generic.List<global::Godot.Bridge.MethodInfo>";
|
||||
|
||||
source.Append(" internal new static ")
|
||||
@@ -179,10 +179,10 @@ namespace Godot.SourceGenerators
|
||||
|
||||
source.Append(" return methods;\n");
|
||||
source.Append(" }\n");
|
||||
|
||||
source.Append("#pragma warning restore CS0109\n");
|
||||
}
|
||||
|
||||
source.Append("#pragma warning restore CS0109\n");
|
||||
|
||||
// Generate InvokeGodotClassMethod
|
||||
|
||||
if (godotClassMethods.Length > 0)
|
||||
@@ -242,7 +242,7 @@ namespace Godot.SourceGenerators
|
||||
|
||||
private static void AppendMethodInfo(StringBuilder source, MethodInfo methodInfo)
|
||||
{
|
||||
source.Append(" methods.Add(new(name: GodotInternal.MethodName_")
|
||||
source.Append(" methods.Add(new(name: MethodName.")
|
||||
.Append(methodInfo.Name)
|
||||
.Append(", returnVal: ");
|
||||
|
||||
@@ -350,7 +350,7 @@ namespace Godot.SourceGenerators
|
||||
source.Append(" ");
|
||||
if (!isFirstEntry)
|
||||
source.Append("else ");
|
||||
source.Append("if (method == GodotInternal.MethodName_");
|
||||
source.Append("if (method == MethodName.");
|
||||
source.Append(methodName);
|
||||
source.Append(") {\n return true;\n }\n");
|
||||
}
|
||||
@@ -362,7 +362,7 @@ namespace Godot.SourceGenerators
|
||||
{
|
||||
string methodName = method.Method.Name;
|
||||
|
||||
source.Append(" if (method == GodotInternal.MethodName_");
|
||||
source.Append(" if (method == MethodName.");
|
||||
source.Append(methodName);
|
||||
source.Append(" && argCount == ");
|
||||
source.Append(method.ParamTypes.Length);
|
||||
|
||||
Reference in New Issue
Block a user