Skip to content

Commit

Permalink
Expose Extension field in FieldDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
ObsidianMinor committed Aug 23, 2019
1 parent 6da14fa commit bdc6cd1
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
Expand Up @@ -66,7 +66,10 @@ public sealed class FieldDescriptor : DescriptorBase, IComparable<FieldDescripto

internal FieldDescriptorProto Proto { get; }

internal Extension Extension { get; }
/// <summary>
/// An extension identifier for this field, or <c>null</c> if this field isn't an extension.
/// </summary>
public Extension Extension { get; }

internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
MessageDescriptor parent, int index, string propertyName, Extension extension)
Expand Down Expand Up @@ -201,19 +204,19 @@ private static FieldType GetFieldTypeFromProtoType(FieldDescriptorProto.Types.Ty
/// <summary>
/// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise.
/// </summary>
public bool IsPacked
{
get
{
if (File.Syntax != Syntax.Proto3)
{
return Proto.Options?.Packed ?? false;
}
else
{
return !Proto.Options.HasPacked || Proto.Options.Packed;
}
}
public bool IsPacked
{
get
{
if (File.Syntax != Syntax.Proto3)
{
return Proto.Options?.Packed ?? false;
}
else
{
return !Proto.Options.HasPacked || Proto.Options.Packed;
}
}
}

/// <summary>
Expand Down Expand Up @@ -393,7 +396,7 @@ internal void CrossLink()
}

private IFieldAccessor CreateAccessor()
{
{
if (Extension != null)
{
return new ExtensionAccessor(this);
Expand Down

0 comments on commit bdc6cd1

Please sign in to comment.