| OLD | NEW |
| 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'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import '../common/names.dart' show | 9 import '../common/resolution.dart' show |
| 10 Identifiers, | 10 Resolution; |
| 11 Names, | |
| 12 Selectors; | |
| 13 import '../compiler.dart' show | 11 import '../compiler.dart' show |
| 14 Compiler; | 12 Compiler; |
| 15 import '../diagnostics/invariant.dart' show | 13 import '../diagnostics/invariant.dart' show |
| 16 invariant; | 14 invariant; |
| 17 import '../diagnostics/spannable.dart' show | |
| 18 SpannableAssertionFailure; | |
| 19 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
| 20 import '../dart_types.dart'; | 16 import '../dart_types.dart'; |
| 21 import '../tree/tree.dart'; | |
| 22 import '../types/types.dart'; | |
| 23 import '../util/util.dart'; | 17 import '../util/util.dart'; |
| 24 import '../world.dart' show | 18 import '../world.dart' show |
| 25 ClassWorld, | 19 ClassWorld, |
| 26 World; | 20 World; |
| 27 | 21 |
| 28 import 'call_structure.dart'; | |
| 29 import 'selector.dart' show | 22 import 'selector.dart' show |
| 30 Selector; | 23 Selector; |
| 31 import 'function_set.dart'; | |
| 32 import 'side_effects.dart'; | |
| 33 | 24 |
| 34 class UniverseSelector { | 25 class UniverseSelector { |
| 35 final Selector selector; | 26 final Selector selector; |
| 36 final ReceiverConstraint mask; | 27 final ReceiverConstraint mask; |
| 37 | 28 |
| 38 UniverseSelector(this.selector, this.mask); | 29 UniverseSelector(this.selector, this.mask); |
| 39 | 30 |
| 40 bool appliesUnnamed(Element element, ClassWorld world) { | 31 bool appliesUnnamed(Element element, ClassWorld world) { |
| 41 return selector.appliesUnnamed(element, world) && | 32 return selector.appliesUnnamed(element, world) && |
| 42 (mask == null || mask.canHit(element, selector, world)); | 33 (mask == null || mask.canHit(element, selector, world)); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 f(String name, Map<Selector, SelectorConstraints> selectors)) { | 377 f(String name, Map<Selector, SelectorConstraints> selectors)) { |
| 387 _invokedGetters.forEach(f); | 378 _invokedGetters.forEach(f); |
| 388 } | 379 } |
| 389 | 380 |
| 390 void forEachInvokedSetter( | 381 void forEachInvokedSetter( |
| 391 f(String name, Map<Selector, SelectorConstraints> selectors)) { | 382 f(String name, Map<Selector, SelectorConstraints> selectors)) { |
| 392 _invokedSetters.forEach(f); | 383 _invokedSetters.forEach(f); |
| 393 } | 384 } |
| 394 | 385 |
| 395 DartType registerIsCheck(DartType type, Compiler compiler) { | 386 DartType registerIsCheck(DartType type, Compiler compiler) { |
| 396 type = type.unalias(compiler); | 387 type = type.unalias(compiler.resolution); |
| 397 // Even in checked mode, type annotations for return type and argument | 388 // Even in checked mode, type annotations for return type and argument |
| 398 // types do not imply type checks, so there should never be a check | 389 // types do not imply type checks, so there should never be a check |
| 399 // against the type variable of a typedef. | 390 // against the type variable of a typedef. |
| 400 isChecks.add(type); | 391 isChecks.add(type); |
| 401 return type; | 392 return type; |
| 402 } | 393 } |
| 403 | 394 |
| 404 void registerStaticFieldUse(FieldElement staticField) { | 395 void registerStaticFieldUse(FieldElement staticField) { |
| 405 assert(Elements.isStaticOrTopLevel(staticField) && staticField.isField); | 396 assert(Elements.isStaticOrTopLevel(staticField) && staticField.isField); |
| 406 assert(staticField.isDeclaration); | 397 assert(staticField.isDeclaration); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 429 // TODO(ahe): Replace this method with something that is O(1), for example, | 420 // TODO(ahe): Replace this method with something that is O(1), for example, |
| 430 // by using a map. | 421 // by using a map. |
| 431 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { | 422 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { |
| 432 // Return new list to guard against concurrent modifications. | 423 // Return new list to guard against concurrent modifications. |
| 433 return new List<LocalFunctionElement>.from( | 424 return new List<LocalFunctionElement>.from( |
| 434 allClosures.where((LocalFunctionElement closure) { | 425 allClosures.where((LocalFunctionElement closure) { |
| 435 return closure.executableContext == element; | 426 return closure.executableContext == element; |
| 436 })); | 427 })); |
| 437 } | 428 } |
| 438 } | 429 } |
| OLD | NEW |