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

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

Issue 1852983002: Fix issues with protobuf equality comparisons (Closed) Base URL: git@github.com:dart-lang/dart-protobuf.git@master
Patch Set: 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
« no previous file with comments | « lib/src/protobuf/field_set.dart ('k') | test/event_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/protobuf/utils.dart
diff --git a/lib/src/protobuf/utils.dart b/lib/src/protobuf/utils.dart
index 364d78f21ff96cb5261ffb871bacbed8b4823a64..31fafcc2d5d73fbe8191920dcacca7a4958b0aff 100644
--- a/lib/src/protobuf/utils.dart
+++ b/lib/src/protobuf/utils.dart
@@ -6,6 +6,10 @@ part of protobuf;
// TODO(antonm): reconsider later if PbList should take care of equality.
bool _deepEquals(lhs, rhs) {
+ // Some GeneratedMessages implement Map, so test this first.
+ if ((lhs is GeneratedMessage) && (rhs is GeneratedMessage)) {
Søren Gjesse 2016/04/04 16:06:27 Maybe negate this if to only have one lhs == rhs.
skybrian 2016/04/04 19:38:02 As a style thing, I'd rather repeat the == check t
+ return lhs == rhs;
+ }
if ((lhs is List) && (rhs is List)) return _areListsEqual(lhs, rhs);
if ((lhs is Map) && (rhs is Map)) return _areMapsEqual(lhs, rhs);
if ((lhs is ByteData) && (rhs is ByteData)) {
« no previous file with comments | « lib/src/protobuf/field_set.dart ('k') | test/event_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698