| 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.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show | 10 import '../compiler.dart' show |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 254 } |
| 255 | 255 |
| 256 /// Register [type] as (directly) instantiated. | 256 /// Register [type] as (directly) instantiated. |
| 257 /// | 257 /// |
| 258 /// If [byMirrors] is `true`, the instantiation is through mirrors. | 258 /// If [byMirrors] is `true`, the instantiation is through mirrors. |
| 259 // TODO(johnniwinther): Fully enforce the separation between exact, through | 259 // TODO(johnniwinther): Fully enforce the separation between exact, through |
| 260 // subclass and through subtype instantiated types/classes. | 260 // subclass and through subtype instantiated types/classes. |
| 261 // TODO(johnniwinther): Support unknown type arguments for generic types. | 261 // TODO(johnniwinther): Support unknown type arguments for generic types. |
| 262 void registerTypeInstantiation(InterfaceType type, | 262 void registerTypeInstantiation(InterfaceType type, |
| 263 {bool byMirrors: false, | 263 {bool byMirrors: false, |
| 264 bool isNative: false, |
| 264 void onImplemented(ClassElement cls)}) { | 265 void onImplemented(ClassElement cls)}) { |
| 265 _instantiatedTypes.add(type); | 266 _instantiatedTypes.add(type); |
| 266 ClassElement cls = type.element; | 267 ClassElement cls = type.element; |
| 267 if (!cls.isAbstract | 268 if (!cls.isAbstract |
| 268 // We can't use the closed-world assumption with native abstract | 269 // We can't use the closed-world assumption with native abstract |
| 269 // classes; a native abstract class may have non-abstract subclasses | 270 // classes; a native abstract class may have non-abstract subclasses |
| 270 // not declared to the program. Instances of these classes are | 271 // not declared to the program. Instances of these classes are |
| 271 // indistinguishable from the abstract class. | 272 // indistinguishable from the abstract class. |
| 272 || cls.isNative | 273 || isNative |
| 273 // Likewise, if this registration comes from the mirror system, | 274 // Likewise, if this registration comes from the mirror system, |
| 274 // all bets are off. | 275 // all bets are off. |
| 275 // TODO(herhut): Track classes required by mirrors seperately. | 276 // TODO(herhut): Track classes required by mirrors seperately. |
| 276 || byMirrors) { | 277 || byMirrors) { |
| 277 _directlyInstantiatedClasses.add(cls); | 278 _directlyInstantiatedClasses.add(cls); |
| 278 } | 279 } |
| 279 | 280 |
| 280 // TODO(johnniwinther): Replace this by separate more specific mappings that | 281 // TODO(johnniwinther): Replace this by separate more specific mappings that |
| 281 // include the type arguments. | 282 // include the type arguments. |
| 282 if (_implementedClasses.add(cls)) { | 283 if (_implementedClasses.add(cls)) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 // TODO(ahe): Replace this method with something that is O(1), for example, | 419 // TODO(ahe): Replace this method with something that is O(1), for example, |
| 419 // by using a map. | 420 // by using a map. |
| 420 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { | 421 List<LocalFunctionElement> slowDirectlyNestedClosures(Element element) { |
| 421 // Return new list to guard against concurrent modifications. | 422 // Return new list to guard against concurrent modifications. |
| 422 return new List<LocalFunctionElement>.from( | 423 return new List<LocalFunctionElement>.from( |
| 423 allClosures.where((LocalFunctionElement closure) { | 424 allClosures.where((LocalFunctionElement closure) { |
| 424 return closure.executableContext == element; | 425 return closure.executableContext == element; |
| 425 })); | 426 })); |
| 426 } | 427 } |
| 427 } | 428 } |
| OLD | NEW |