| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // Test of Compiler.forgetElement. | 5 // Test of Compiler.forgetElement. |
| 6 library trydart.forget_element_test; | 6 library trydart.forget_element_test; |
| 7 | 7 |
| 8 import 'package:compiler/implementation/elements/elements.dart' show | 8 import 'package:compiler/implementation/elements/elements.dart' show |
| 9 AstElement, | 9 AstElement, |
| 10 ClassElement, | 10 ClassElement, |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Map cache = compiler.closureToClassMapper.closureMappingCache; | 222 Map cache = compiler.closureToClassMapper.closureMappingCache; |
| 223 return nodesIn(library).where((node) => cache[node] != null); | 223 return nodesIn(library).where((node) => cache[node] != null); |
| 224 } | 224 } |
| 225 | 225 |
| 226 Iterable codegenTypesIn(LibraryElement library) { | 226 Iterable codegenTypesIn(LibraryElement library) { |
| 227 return codegenUniverse.instantiatedTypes.where( | 227 return codegenUniverse.instantiatedTypes.where( |
| 228 (DartType type) => type.element.library == library); | 228 (DartType type) => type.element.library == library); |
| 229 } | 229 } |
| 230 | 230 |
| 231 Iterable codegenClassesIn(LibraryElement library) { | 231 Iterable codegenClassesIn(LibraryElement library) { |
| 232 return codegenUniverse.instantiatedClasses.where( | 232 return codegenUniverse.directlyInstantiatedClasses.where( |
| 233 (ClassElement cls) => cls.library == library); | 233 (ClassElement cls) => cls.library == library); |
| 234 } | 234 } |
| 235 | 235 |
| 236 Iterable codegenMembersIn(LibraryElement library) { | 236 Iterable codegenMembersIn(LibraryElement library) { |
| 237 sameLibrary(e) => e.library == library; | 237 sameLibrary(e) => e.library == library; |
| 238 return new Set() | 238 return new Set() |
| 239 ..addAll(codegenUniverse.closurizedMembers.where(sameLibrary)) | 239 ..addAll(codegenUniverse.closurizedMembers.where(sameLibrary)) |
| 240 ..addAll(codegenUniverse.fieldSetters.where(sameLibrary)) | 240 ..addAll(codegenUniverse.fieldSetters.where(sameLibrary)) |
| 241 ..addAll(codegenUniverse.fieldGetters.where(sameLibrary)); | 241 ..addAll(codegenUniverse.fieldGetters.where(sameLibrary)); |
| 242 } | 242 } |
| 243 | 243 |
| 244 Iterable resolutionTypesIn(LibraryElement library) { | 244 Iterable resolutionTypesIn(LibraryElement library) { |
| 245 return resolutionUniverse.instantiatedTypes.where( | 245 return resolutionUniverse.instantiatedTypes.where( |
| 246 (DartType type) => type.element.library == library); | 246 (DartType type) => type.element.library == library); |
| 247 } | 247 } |
| 248 | 248 |
| 249 Iterable resolutionClassesIn(LibraryElement library) { | 249 Iterable resolutionClassesIn(LibraryElement library) { |
| 250 return resolutionUniverse.instantiatedClasses.where( | 250 return resolutionUniverse.directlyInstantiatedClasses.where( |
| 251 (ClassElement cls) => cls.library == library); | 251 (ClassElement cls) => cls.library == library); |
| 252 } | 252 } |
| 253 | 253 |
| 254 Iterable resolutionMembersIn(LibraryElement library) { | 254 Iterable resolutionMembersIn(LibraryElement library) { |
| 255 sameLibrary(e) => e.library == library; | 255 sameLibrary(e) => e.library == library; |
| 256 return new Set() | 256 return new Set() |
| 257 ..addAll(resolutionUniverse.closurizedMembers.where(sameLibrary)) | 257 ..addAll(resolutionUniverse.closurizedMembers.where(sameLibrary)) |
| 258 ..addAll(resolutionUniverse.fieldSetters.where(sameLibrary)) | 258 ..addAll(resolutionUniverse.fieldSetters.where(sameLibrary)) |
| 259 ..addAll(resolutionUniverse.fieldGetters.where(sameLibrary)); | 259 ..addAll(resolutionUniverse.fieldGetters.where(sameLibrary)); |
| 260 } | 260 } |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Test that a constant in a parameter initializer is discarded | 394 // Test that a constant in a parameter initializer is discarded |
| 395 // correctly (deeply nested function). | 395 // correctly (deeply nested function). |
| 396 new ForgetElementTestCase( | 396 new ForgetElementTestCase( |
| 397 'main() => (() => (([x = const Constant()]) => x)())();' | 397 'main() => (() => (([x = const Constant()]) => x)())();' |
| 398 ' $CONSTANT_CLASS', | 398 ' $CONSTANT_CLASS', |
| 399 closureCount: 2, | 399 closureCount: 2, |
| 400 constantCount: 1, | 400 constantCount: 1, |
| 401 initialValueCount: 1), | 401 initialValueCount: 1), |
| 402 | 402 |
| 403 ]..addAll(assertUnimplementedLocalMetadata()); | 403 ]..addAll(assertUnimplementedLocalMetadata()); |
| OLD | NEW |