Chromium Code Reviews| Index: lib/src/protobuf/field_info.dart |
| diff --git a/lib/src/protobuf/field_info.dart b/lib/src/protobuf/field_info.dart |
| index d9235756a452b23b7ff3884dfdaa43a5c4a97ff7..0a7886963ff174e95462c06b98a620cd9d093963 100644 |
| --- a/lib/src/protobuf/field_info.dart |
| +++ b/lib/src/protobuf/field_info.dart |
| @@ -7,7 +7,7 @@ part of protobuf; |
| /** |
| * An object representing a protobuf message field. |
| */ |
| -class FieldInfo { |
| +class FieldInfo<T> { |
| final String name; |
| final int tagNumber; |
| final int index; // index of the field's value. Null for extensions. |
| @@ -46,7 +46,7 @@ class FieldInfo { |
| [this.valueOf]) |
| : this.type = type, |
| this.check = check, |
| - this.makeDefault = (() => new PbList(check: check)) { |
| + this.makeDefault = (() => new PbList<T>(check: check)) { |
|
skybrian
2016/04/01 18:01:40
This is a bit inconsistent.
For a non-repeated fi
|
| assert(name != null); |
| assert(tagNumber != null); |
| assert(_isRepeated(type)); |
| @@ -121,5 +121,14 @@ class FieldInfo { |
| } |
| } |
| + /// Creates a repeated field to be attached to the given message. |
| + /// |
| + /// Delegates actual list creation to the message, so that it can |
| + /// be overridden by a mixin. |
| + List<T> _createRepeatedField(GeneratedMessage m) { |
| + assert(isRepeated); |
| + return m.createRepeatedField/*<T>*/(tagNumber, this); |
| + } |
| + |
| String toString() => name; |
| } |