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

Unified Diff: lib/src/protobuf/extension_field_set.dart

Issue 1844293003: Add generic types for strong mode (Closed) Base URL: git@github.com:dart-lang/dart-protobuf.git@master
Patch Set: oops, change all callers to use fi._createRepeatedField Created 4 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/protobuf/extension_field_set.dart
diff --git a/lib/src/protobuf/extension_field_set.dart b/lib/src/protobuf/extension_field_set.dart
index e2bbd27ef3a419115895137aad6a47bed39ca8a8..87782624bb8cfd910d7171abba1a762a54f95c39 100644
--- a/lib/src/protobuf/extension_field_set.dart
+++ b/lib/src/protobuf/extension_field_set.dart
@@ -38,19 +38,19 @@ class _ExtensionFieldSet {
///
/// If it doesn't exist, creates the list and saves the extension.
/// Suitable for public API and decoders.
- List _ensureRepeatedField(Extension fi) {
+ List/*<T>*/ _ensureRepeatedField/*<T>*/(Extension/*<T>*/ fi) {
assert(fi.isRepeated);
assert(fi.extendee == _parent._messageName);
var list = _values[fi.tagNumber];
- if (list != null) return list;
+ if (list != null) return list as List/*<T>*/;
Leaf 2016/04/01 17:09:56 Is this going to have the right dynamic type (and
skybrian 2016/04/01 18:01:40 It's not statically checkable but the intent is th
skybrian 2016/04/01 18:04:35 On second thought, maybe this doesn't work? I'm re
Leaf 2016/04/01 18:15:59 If PbList<T> implements or extends List<T>, then y
// Add info and create list.
_validateInfo(fi);
- list = _parent._message.createRepeatedField(fi.tagNumber, fi);
+ var newList = fi._createRepeatedField(_parent._message);
_addInfoUnchecked(fi);
- _setFieldUnchecked(fi, list);
- return list;
+ _setFieldUnchecked(fi, newList);
+ return newList;
}
_getFieldOrNull(Extension extension) => _values[extension.tagNumber];

Powered by Google App Engine
This is Rietveld 408576698