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

Side by Side Diff: pkg/compiler/lib/src/serialization/equivalence.dart

Issue 1856953003: Test closed world model after deserialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 /// Functions for asserting equivalence across serialization. 5 /// Functions for asserting equivalence across serialization.
6 6
7 library dart2js.serialization.equivalence; 7 library dart2js.serialization.equivalence;
8 8
9 import '../common/resolution.dart'; 9 import '../common/resolution.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 return true; 33 return true;
34 } 34 }
35 35
36 /// Returns `true` if the elements in [a] and [b] are equivalent as sets using 36 /// Returns `true` if the elements in [a] and [b] are equivalent as sets using
37 /// [elementEquivalence] to determine element equivalence. 37 /// [elementEquivalence] to determine element equivalence.
38 bool areSetsEquivalent( 38 bool areSetsEquivalent(
39 Iterable set1, 39 Iterable set1,
40 Iterable set2, 40 Iterable set2,
41 [bool elementEquivalence(a, b) = equality]) { 41 [bool elementEquivalence(a, b) = equality]) {
42
43 Set remaining = set2.toSet(); 42 Set remaining = set2.toSet();
44 for (var element1 in set1) { 43 for (var element1 in set1) {
45 bool found = false; 44 bool found = false;
46 for (var element2 in set2) { 45 for (var element2 in set2) {
47 if (elementEquivalence(element1, element2)) { 46 if (elementEquivalence(element1, element2)) {
48 found = true; 47 found = true;
49 remaining.remove(element2); 48 remaining.remove(element2);
50 break; 49 break;
51 } 50 }
52 } 51 }
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 areMapLiteralUsesEquivalent) && 691 areMapLiteralUsesEquivalent) &&
693 strategy.testSets( 692 strategy.testSets(
694 impact1, impact2, 'staticUses', 693 impact1, impact2, 'staticUses',
695 impact1.staticUses, impact2.staticUses, 694 impact1.staticUses, impact2.staticUses,
696 areStaticUsesEquivalent) && 695 areStaticUsesEquivalent) &&
697 strategy.testSets( 696 strategy.testSets(
698 impact1, impact2, 'typeUses', 697 impact1, impact2, 'typeUses',
699 impact1.typeUses, impact2.typeUses, 698 impact1.typeUses, impact2.typeUses,
700 areTypeUsesEquivalent); 699 areTypeUsesEquivalent);
701 } 700 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/element_serialization.dart ('k') | pkg/compiler/lib/src/serialization/keys.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698