Commit bdc6cd1d authored by Sydney Acksman's avatar Sydney Acksman

Expose Extension field in FieldDescriptor

parent 6da14fa9
...@@ -66,7 +66,10 @@ namespace Google.Protobuf.Reflection ...@@ -66,7 +66,10 @@ namespace Google.Protobuf.Reflection
internal FieldDescriptorProto Proto { get; } 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, internal FieldDescriptor(FieldDescriptorProto proto, FileDescriptor file,
MessageDescriptor parent, int index, string propertyName, Extension extension) MessageDescriptor parent, int index, string propertyName, Extension extension)
...@@ -201,19 +204,19 @@ namespace Google.Protobuf.Reflection ...@@ -201,19 +204,19 @@ namespace Google.Protobuf.Reflection
/// <summary> /// <summary>
/// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise. /// Returns <c>true</c> if this field is a packed, repeated field; <c>false</c> otherwise.
/// </summary> /// </summary>
public bool IsPacked public bool IsPacked
{ {
get get
{ {
if (File.Syntax != Syntax.Proto3) if (File.Syntax != Syntax.Proto3)
{ {
return Proto.Options?.Packed ?? false; return Proto.Options?.Packed ?? false;
} }
else else
{ {
return !Proto.Options.HasPacked || Proto.Options.Packed; return !Proto.Options.HasPacked || Proto.Options.Packed;
} }
} }
} }
/// <summary> /// <summary>
...@@ -393,7 +396,7 @@ namespace Google.Protobuf.Reflection ...@@ -393,7 +396,7 @@ namespace Google.Protobuf.Reflection
} }
private IFieldAccessor CreateAccessor() private IFieldAccessor CreateAccessor()
{ {
if (Extension != null) if (Extension != null)
{ {
return new ExtensionAccessor(this); return new ExtensionAccessor(this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment