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

Side by Side Diff: pkg/compiler/lib/src/universe/world_impact.dart

Issue 1416253002: Remove requiredTypes (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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) 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 library dart2js.universe.world_impact; 5 library dart2js.universe.world_impact;
6 6
7 import '../dart_types.dart' show 7 import '../dart_types.dart' show
8 DartType, 8 DartType,
9 InterfaceType; 9 InterfaceType;
10 import '../elements/elements.dart' show 10 import '../elements/elements.dart' show
(...skipping 22 matching lines...) Expand all
33 Iterable<InterfaceType> get instantiatedTypes => const <InterfaceType>[]; 33 Iterable<InterfaceType> get instantiatedTypes => const <InterfaceType>[];
34 34
35 // TODO(johnniwinther): Collect checked types for checked mode separately to 35 // TODO(johnniwinther): Collect checked types for checked mode separately to
36 // support serialization. 36 // support serialization.
37 Iterable<DartType> get isChecks => const <DartType>[]; 37 Iterable<DartType> get isChecks => const <DartType>[];
38 38
39 Iterable<DartType> get checkedModeChecks => const <DartType>[]; 39 Iterable<DartType> get checkedModeChecks => const <DartType>[];
40 40
41 Iterable<DartType> get asCasts => const <DartType>[]; 41 Iterable<DartType> get asCasts => const <DartType>[];
42 42
43 Iterable<DartType> get onCatchTypes => const <DartType>[];
44
43 Iterable<MethodElement> get closurizedFunctions => const <MethodElement>[]; 45 Iterable<MethodElement> get closurizedFunctions => const <MethodElement>[];
44 46
45 Iterable<LocalFunctionElement> get closures => const <LocalFunctionElement>[]; 47 Iterable<LocalFunctionElement> get closures => const <LocalFunctionElement>[];
46 48
47 Iterable<DartType> get typeLiterals => const <DartType>[]; 49 Iterable<DartType> get typeLiterals => const <DartType>[];
48 50
49 String toString() { 51 String toString() => dump(this);
52
53 static String dump(WorldImpact worldImpact) {
50 StringBuffer sb = new StringBuffer(); 54 StringBuffer sb = new StringBuffer();
51 55 printOn(sb, worldImpact);
56 return sb.toString();
57 }
sigurdm 2015/10/22 09:18:03 empty line between members
Johnni Winther 2015/10/22 10:31:55 Done.
58 static void printOn(StringBuffer sb, WorldImpact worldImpact) {
sigurdm 2015/10/22 09:18:03 Why is this static?
Johnni Winther 2015/10/22 10:31:55 So it can be required between for subclasses and s
52 void add(String title, Iterable iterable) { 59 void add(String title, Iterable iterable) {
53 if (iterable.isNotEmpty) { 60 if (iterable.isNotEmpty) {
54 sb.write('\n $title:'); 61 sb.write('\n $title:');
55 iterable.forEach((e) => sb.write('\n $e')); 62 iterable.forEach((e) => sb.write('\n $e'));
56 } 63 }
57 } 64 }
58 65
59 add('dynamic invocations', dynamicInvocations); 66 add('dynamic invocations', worldImpact.dynamicInvocations);
60 add('dynamic getters', dynamicGetters); 67 add('dynamic getters', worldImpact.dynamicGetters);
61 add('dynamic setters', dynamicSetters); 68 add('dynamic setters', worldImpact.dynamicSetters);
62 add('static uses', staticUses); 69 add('static uses', worldImpact.staticUses);
63 add('instantiated types', instantiatedTypes); 70 add('instantiated types', worldImpact.instantiatedTypes);
64 add('is-checks', isChecks); 71 add('is-checks', worldImpact.isChecks);
65 add('checked-mode checks', checkedModeChecks); 72 add('checked-mode checks', worldImpact.checkedModeChecks);
66 add('as-casts', asCasts); 73 add('as-casts', worldImpact.asCasts);
67 add('closurized functions', closurizedFunctions); 74 add('on-catch-types', worldImpact.onCatchTypes);
68 add('closures', closures); 75 add('closurized functions', worldImpact.closurizedFunctions);
69 add('type literals', typeLiterals); 76 add('closures', worldImpact.closures);
70 77 add('type literals', worldImpact.typeLiterals);
71 return sb.toString();
72 } 78 }
73 } 79 }
74 80
75 class WorldImpactBuilder { 81 class WorldImpactBuilder {
76 // TODO(johnniwinther): Do we benefit from lazy initialization of the 82 // TODO(johnniwinther): Do we benefit from lazy initialization of the
77 // [Setlet]s? 83 // [Setlet]s?
78 Setlet<UniverseSelector> _dynamicInvocations; 84 Setlet<UniverseSelector> _dynamicInvocations;
79 Setlet<UniverseSelector> _dynamicGetters; 85 Setlet<UniverseSelector> _dynamicGetters;
80 Setlet<UniverseSelector> _dynamicSetters; 86 Setlet<UniverseSelector> _dynamicSetters;
81 Setlet<InterfaceType> _instantiatedTypes; 87 Setlet<InterfaceType> _instantiatedTypes;
82 Setlet<Element> _staticUses; 88 Setlet<Element> _staticUses;
83 Setlet<DartType> _isChecks; 89 Setlet<DartType> _isChecks;
84 Setlet<DartType> _asCasts; 90 Setlet<DartType> _asCasts;
85 Setlet<DartType> _checkedModeChecks; 91 Setlet<DartType> _checkedModeChecks;
92 Setlet<DartType> _onCatchTypes;
86 Setlet<MethodElement> _closurizedFunctions; 93 Setlet<MethodElement> _closurizedFunctions;
87 Setlet<LocalFunctionElement> _closures; 94 Setlet<LocalFunctionElement> _closures;
88 Setlet<DartType> _typeLiterals; 95 Setlet<DartType> _typeLiterals;
89 96
90 void registerDynamicGetter(UniverseSelector selector) { 97 void registerDynamicGetter(UniverseSelector selector) {
91 assert(selector != null); 98 assert(selector != null);
92 if (_dynamicGetters == null) { 99 if (_dynamicGetters == null) {
93 _dynamicGetters = new Setlet<UniverseSelector>(); 100 _dynamicGetters = new Setlet<UniverseSelector>();
94 } 101 }
95 _dynamicGetters.add(selector); 102 _dynamicGetters.add(selector);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 _checkedModeChecks = new Setlet<DartType>(); 201 _checkedModeChecks = new Setlet<DartType>();
195 } 202 }
196 _checkedModeChecks.add(type); 203 _checkedModeChecks.add(type);
197 } 204 }
198 205
199 Iterable<DartType> get checkedModeChecks { 206 Iterable<DartType> get checkedModeChecks {
200 return _checkedModeChecks != null 207 return _checkedModeChecks != null
201 ? _checkedModeChecks : const <DartType>[]; 208 ? _checkedModeChecks : const <DartType>[];
202 } 209 }
203 210
211 void registerOnCatchType(DartType type) {
212 assert(type != null);
213 if (_onCatchTypes == null) {
214 _onCatchTypes = new Setlet<DartType>();
215 }
216 _onCatchTypes.add(type);
217 }
218
219 Iterable<DartType> get onCatchTypes {
220 return _onCatchTypes != null
221 ? _onCatchTypes : const <DartType>[];
222 }
223
204 void registerClosurizedFunction(MethodElement element) { 224 void registerClosurizedFunction(MethodElement element) {
205 if (_closurizedFunctions == null) { 225 if (_closurizedFunctions == null) {
206 _closurizedFunctions = new Setlet<MethodElement>(); 226 _closurizedFunctions = new Setlet<MethodElement>();
207 } 227 }
208 _closurizedFunctions.add(element); 228 _closurizedFunctions.add(element);
209 } 229 }
210 230
211 Iterable<MethodElement> get closurizedFunctions { 231 Iterable<MethodElement> get closurizedFunctions {
212 return _closurizedFunctions != null 232 return _closurizedFunctions != null
213 ? _closurizedFunctions : const <MethodElement>[]; 233 ? _closurizedFunctions : const <MethodElement>[];
214 } 234 }
215 235
216 void registerClosure(LocalFunctionElement element) { 236 void registerClosure(LocalFunctionElement element) {
217 if (_closures == null) { 237 if (_closures == null) {
218 _closures = new Setlet<LocalFunctionElement>(); 238 _closures = new Setlet<LocalFunctionElement>();
219 } 239 }
220 _closures.add(element); 240 _closures.add(element);
221 } 241 }
222 242
223 Iterable<LocalFunctionElement> get closures { 243 Iterable<LocalFunctionElement> get closures {
224 return _closures != null 244 return _closures != null
225 ? _closures : const <LocalFunctionElement>[]; 245 ? _closures : const <LocalFunctionElement>[];
226 } 246 }
227 } 247 }
OLDNEW
« pkg/compiler/lib/src/resolution/members.dart ('K') | « pkg/compiler/lib/src/typechecker.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698