Files
externals/src/protobuf-net/internal_only.patch
T

52 lines
2.5 KiB
Diff

diff --git a/src/protobuf-net.Reflection/CSharpCodeGenerator.cs b/src/protobuf-net.Reflection/CSharpCodeGenerator.cs
index edd6f1c..8be0237 100644
--- a/src/protobuf-net.Reflection/CSharpCodeGenerator.cs
+++ b/src/protobuf-net.Reflection/CSharpCodeGenerator.cs
@@ -175,14 +175,7 @@ namespace ProtoBuf.Reflection
/// </summary>
protected override void WriteEnumValue(GeneratorContext ctx, EnumValueDescriptorProto obj, ref object state)
{
- var name = ctx.NameNormalizer.GetName(obj);
- if (name != obj.Name)
- {
- var tw = ctx.Write($@"[global::ProtoBuf.ProtoEnum(");
- tw.Write($@"Name = @""{obj.Name}""");
- tw.WriteLine(")]");
- }
-
+ var name = obj.Name;
WriteOptions(ctx, obj.Options);
ctx.WriteLine($"{Escape(name)} = {obj.Number},");
}
@@ -204,7 +197,7 @@ namespace ProtoBuf.Reflection
if (name != obj.Name) tw.Write($@"Name = @""{obj.Name}""");
tw.WriteLine(")]");
WriteOptions(ctx, obj.Options);
- tw = ctx.Write($"{GetAccess(GetAccess(obj))} partial class {Escape(name)}");
+ tw = ctx.Write($"internal partial class {Escape(name)}");
if (obj.ExtensionRanges.Count != 0) tw.Write(" : global::ProtoBuf.IExtensible");
tw.WriteLine();
ctx.WriteLine("{").Indent();
@@ -332,7 +325,7 @@ namespace ProtoBuf.Reflection
if (found != null)
{
- defaultValue = ctx.NameNormalizer.GetName(found);
+ defaultValue = found.Name;
}
if (!string.IsNullOrWhiteSpace(defaultValue))
{
diff --git a/src/protobuf-net.Reflection/CodeGenerator.cs b/src/protobuf-net.Reflection/CodeGenerator.cs
index 2d3ede7..9d88d2f 100644
--- a/src/protobuf-net.Reflection/CodeGenerator.cs
+++ b/src/protobuf-net.Reflection/CodeGenerator.cs
@@ -134,7 +134,7 @@ namespace ProtoBuf.Reflection
string generated;
using (var buffer = new StringWriter())
{
- var ctx = new GeneratorContext(file, normalizer ?? NameNormalizer.Default, buffer, Indent);
+ var ctx = new GeneratorContext(file, normalizer ?? NameNormalizer.Null, buffer, Indent);
ctx.BuildTypeIndex(); // populates for TryFind<T>
WriteFile(ctx, file);