Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/protobuf/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs

Issue 2495533002: third_party/protobuf: Update to HEAD (83d681ee2c) (Closed)
Patch Set: Make chrome settings proto generated file a component Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #region Copyright notice and license 1 #region Copyright notice and license
2 // Protocol Buffers - Google's data interchange format 2 // Protocol Buffers - Google's data interchange format
3 // Copyright 2008 Google Inc. All rights reserved. 3 // Copyright 2008 Google Inc. All rights reserved.
4 // https://developers.google.com/protocol-buffers/ 4 // https://developers.google.com/protocol-buffers/
5 // 5 //
6 // Redistribution and use in source and binary forms, with or without 6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are 7 // modification, are permitted provided that the following conditions are
8 // met: 8 // met:
9 // 9 //
10 // * Redistributions of source code must retain the above copyright 10 // * Redistributions of source code must retain the above copyright
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 ContainingOneof = parent.Oneofs[proto.OneofIndex]; 90 ContainingOneof = parent.Oneofs[proto.OneofIndex];
91 } 91 }
92 92
93 file.DescriptorPool.AddSymbol(this); 93 file.DescriptorPool.AddSymbol(this);
94 // We can't create the accessor until we've cross-linked, unfortunat ely, as we 94 // We can't create the accessor until we've cross-linked, unfortunat ely, as we
95 // may not know whether the type of the field is a map or not. Remem ber the property name 95 // may not know whether the type of the field is a map or not. Remem ber the property name
96 // for later. 96 // for later.
97 // We could trust the generated code and check whether the type of t he property is 97 // We could trust the generated code and check whether the type of t he property is
98 // a MapField, but that feels a tad nasty. 98 // a MapField, but that feels a tad nasty.
99 this.propertyName = propertyName; 99 this.propertyName = propertyName;
100 JsonName = Proto.JsonName == "" ? JsonFormatter.ToCamelCase(Proto.N ame) : Proto.JsonName; 100 JsonName = Proto.JsonName == "" ? JsonFormatter.ToJsonName(Proto.Na me) : Proto.JsonName;
101 } 101 }
102 102
103 103
104 /// <summary> 104 /// <summary>
105 /// The brief name of the descriptor's target. 105 /// The brief name of the descriptor's target.
106 /// </summary> 106 /// </summary>
107 public override string Name => Proto.Name; 107 public override string Name => Proto.Name;
108 108
109 /// <summary> 109 /// <summary>
110 /// Returns the accessor for this field. 110 /// Returns the accessor for this field.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 if (property == null) 334 if (property == null)
335 { 335 {
336 throw new DescriptorValidationException(this, $"Property {proper tyName} not found in {ContainingType.ClrType}"); 336 throw new DescriptorValidationException(this, $"Property {proper tyName} not found in {ContainingType.ClrType}");
337 } 337 }
338 return IsMap ? new MapFieldAccessor(property, this) 338 return IsMap ? new MapFieldAccessor(property, this)
339 : IsRepeated ? new RepeatedFieldAccessor(property, this) 339 : IsRepeated ? new RepeatedFieldAccessor(property, this)
340 : (IFieldAccessor) new SingleFieldAccessor(property, this); 340 : (IFieldAccessor) new SingleFieldAccessor(property, this);
341 } 341 }
342 } 342 }
343 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698