diff options
author | Jon Skeet <jonskeet@google.com> | 2015-11-19 17:13:38 +0000 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-11-22 16:25:44 +0000 |
commit | 72ec33676fd40ccfe719ace162fcf859ae9251bc (patch) | |
tree | a90f4be5e939a8a55175aa1d4e8e54c7f919feb1 /csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs | |
parent | d6202a9b8948d5a2d5436e3b35b175ed9b8a9fd1 (diff) | |
download | protobuf-72ec33676fd40ccfe719ace162fcf859ae9251bc.tar.gz protobuf-72ec33676fd40ccfe719ace162fcf859ae9251bc.tar.bz2 protobuf-72ec33676fd40ccfe719ace162fcf859ae9251bc.zip |
Tidy up reflection in advance of attempting to implement DynamicMessage.
There are corner cases where MessageDescriptor.{ClrType,Parser} will return null, and these are now documented. However, normally they *should* be implemented, even for descriptors of for dynamic messages. Ditto FieldDescriptor.Accessor.
We'll still need a fair amount of work to implement dynamic messages, but this change means that the public API will be remain intact.
Additionally, this change starts making use of C# 6 features in the files that it touches. This is far from exhaustive, and later PRs will have more.
Generated code changes coming in the next commit.
Diffstat (limited to 'csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs index 285f26f3..57abbbff 100644 --- a/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs +++ b/csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs @@ -43,13 +43,13 @@ namespace Google.Protobuf.Reflection private readonly EnumDescriptorProto proto; private readonly MessageDescriptor containingType; private readonly IList<EnumValueDescriptor> values; - private readonly Type generatedType; + private readonly Type clrType; internal EnumDescriptor(EnumDescriptorProto proto, FileDescriptor file, MessageDescriptor parent, int index, Type generatedType) : base(file, file.ComputeFullName(parent, proto.Name), index) { this.proto = proto; - this.generatedType = generatedType; + this.clrType = generatedType; containingType = parent; if (proto.Value.Count == 0) @@ -73,9 +73,9 @@ namespace Google.Protobuf.Reflection public override string Name { get { return proto.Name; } } /// <summary> - /// The generated type for this enum, or <c>null</c> if the descriptor does not represent a generated type. + /// The CLR type for this enum. For generated code, this will be a CLR enum type. /// </summary> - public Type GeneratedType { get { return generatedType; } } + public Type ClrType { get { return clrType; } } /// <value> /// If this is a nested type, get the outer descriptor, otherwise null. |