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

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: tweak _deepEquals, improve tests Created 4 years, 8 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..6e6482bcdc104e90d5c02aa800f48271b10f0b24 100644
--- a/lib/src/protobuf/utils.dart
+++ b/lib/src/protobuf/utils.dart
@@ -6,6 +6,9 @@ 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) return lhs == rhs;
+ if (rhs is GeneratedMessage) return false;
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