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

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

Issue 1258243002: Expose getter and setter invocations by name, in dart2js 'World'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | tests/compiler/dart2js/analyze_unused_dart2js_test.dart » ('j') | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 universe; 5 library universe;
6 6
7 import 'dart:collection';
8
7 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
8 import '../dart2jslib.dart'; 10 import '../dart2jslib.dart';
9 import '../dart_types.dart'; 11 import '../dart_types.dart';
10 import '../types/types.dart'; 12 import '../types/types.dart';
11 import '../tree/tree.dart'; 13 import '../tree/tree.dart';
12 import '../util/util.dart'; 14 import '../util/util.dart';
13 15
14 part 'function_set.dart'; 16 part 'function_set.dart';
15 part 'side_effects.dart'; 17 part 'side_effects.dart';
16 18
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 Selector selector = universeSelector.selector; 272 Selector selector = universeSelector.selector;
271 String name = selector.name; 273 String name = selector.name;
272 TypeMask mask = universeSelector.mask; 274 TypeMask mask = universeSelector.mask;
273 Map<Selector, TypeMaskSet> selectors = selectorMap.putIfAbsent( 275 Map<Selector, TypeMaskSet> selectors = selectorMap.putIfAbsent(
274 name, () => new Maplet<Selector, TypeMaskSet>()); 276 name, () => new Maplet<Selector, TypeMaskSet>());
275 IncreasingTypeMaskSet masks = selectors.putIfAbsent( 277 IncreasingTypeMaskSet masks = selectors.putIfAbsent(
276 selector, () => new IncreasingTypeMaskSet()); 278 selector, () => new IncreasingTypeMaskSet());
277 return masks.add(mask); 279 return masks.add(mask);
278 } 280 }
279 281
282 Map<Selector, TypeMaskSet> _asUnmodifiable(Map<Selector, TypeMaskSet> map) {
283 if (map == null) return null;
284 return new UnmodifiableMapView(map);
285 }
286
280 Map<Selector, TypeMaskSet> invocationsByName(String name) { 287 Map<Selector, TypeMaskSet> invocationsByName(String name) {
281 return _invokedNames[name]; 288 return _asUnmodifiable(_invokedNames[name]);
289 }
290
291 Map<Selector, TypeMaskSet> getterInvocationsByName(String name) {
292 return _asUnmodifiable(_invokedGetters[name]);
293 }
294
295 Map<Selector, TypeMaskSet> setterInvocationsByName(String name) {
296 return _asUnmodifiable(_invokedSetters[name]);
282 } 297 }
283 298
284 void forEachInvokedName( 299 void forEachInvokedName(
285 f(String name, Map<Selector, TypeMaskSet> selectors)) { 300 f(String name, Map<Selector, TypeMaskSet> selectors)) {
286 _invokedNames.forEach(f); 301 _invokedNames.forEach(f);
287 } 302 }
288 303
289 void forEachInvokedGetter( 304 void forEachInvokedGetter(
290 f(String name, Map<Selector, TypeMaskSet> selectors)) { 305 f(String name, Map<Selector, TypeMaskSet> selectors)) {
291 _invokedGetters.forEach(f); 306 _invokedGetters.forEach(f);
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 // Add bits from the call structure. 901 // Add bits from the call structure.
887 return Hashing.mixHashCodeBits(hash, callStructure.hashCode); 902 return Hashing.mixHashCodeBits(hash, callStructure.hashCode);
888 } 903 }
889 904
890 String toString() { 905 String toString() {
891 return 'Selector($kind, $name, ${callStructure.structureToString()})'; 906 return 'Selector($kind, $name, ${callStructure.structureToString()})';
892 } 907 }
893 908
894 Selector toCallSelector() => new Selector.callClosureFrom(this); 909 Selector toCallSelector() => new Selector.callClosureFrom(this);
895 } 910 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/analyze_unused_dart2js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698