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

Side by Side Diff: lib/src/protobuf/field_set.dart

Issue 2606753003: Fix error reported by analyzer. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of protobuf; 5 part of protobuf;
6 6
7 /// All the data in a GeneratedMessage. 7 /// All the data in a GeneratedMessage.
8 /// 8 ///
9 /// These fields and methods are in a separate class to avoid 9 /// These fields and methods are in a separate class to avoid
10 /// polymorphic access due to inheritance. This turns out to 10 /// polymorphic access due to inheritance. This turns out to
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 354 }
355 355
356 /// Calculates a hash code based on the contents of the protobuf. 356 /// Calculates a hash code based on the contents of the protobuf.
357 /// 357 ///
358 /// The hash may change when any field changes (recursively). 358 /// The hash may change when any field changes (recursively).
359 /// Therefore, protobufs used as map keys shouldn't be changed. 359 /// Therefore, protobufs used as map keys shouldn't be changed.
360 int get _hashCode { 360 int get _hashCode {
361 int hash; 361 int hash;
362 362
363 void hashEnumList(PbList enums) { 363 void hashEnumList(PbList enums) {
364 for (final enm in enums) { 364 for (ProtobufEnum enm in enums) {
365 hash = (31 * hash + enm.value) & 0x3fffffff; 365 hash = (31 * hash + enm.value) & 0x3fffffff;
366 } 366 }
367 } 367 }
368 368
369 // Hashes the value of one field (recursively). 369 // Hashes the value of one field (recursively).
370 void hashField(FieldInfo fi, value) { 370 void hashField(FieldInfo fi, value) {
371 if (value is List && value.isEmpty) { 371 if (value is List && value.isEmpty) {
372 return; // It's either repeated or an empty byte array. 372 return; // It's either repeated or an empty byte array.
373 } 373 }
374 hash = ((37 * hash) + fi.tagNumber) & 0x3fffffff; 374 hash = ((37 * hash) + fi.tagNumber) & 0x3fffffff;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 void _appendInvalidFields(List<String> problems, String prefix) { 552 void _appendInvalidFields(List<String> problems, String prefix) {
553 if (!_hasRequiredFields) return; 553 if (!_hasRequiredFields) return;
554 for (var fi in _infos) { 554 for (var fi in _infos) {
555 var value = _values[fi.index]; 555 var value = _values[fi.index];
556 fi._appendInvalidFields(problems, value, prefix); 556 fi._appendInvalidFields(problems, value, prefix);
557 } 557 }
558 // TODO(skybrian): search extensions as well 558 // TODO(skybrian): search extensions as well
559 // https://github.com/dart-lang/dart-protobuf/issues/46 559 // https://github.com/dart-lang/dart-protobuf/issues/46
560 } 560 }
561 } 561 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698