OLD | NEW |
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 related_types; | 5 library related_types; |
6 | 6 |
7 import 'package:compiler/src/commandline_options.dart'; | 7 import 'package:compiler/src/commandline_options.dart'; |
8 import 'package:compiler/src/compiler.dart'; | 8 import 'package:compiler/src/compiler.dart'; |
9 import 'package:compiler/src/core_types.dart'; | 9 import 'package:compiler/src/core_types.dart'; |
10 import 'package:compiler/src/dart_types.dart'; | 10 import 'package:compiler/src/dart_types.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 if (result.isSuccess) { | 28 if (result.isSuccess) { |
29 checkRelatedTypes(result.compiler); | 29 checkRelatedTypes(result.compiler); |
30 } | 30 } |
31 } else { | 31 } else { |
32 print('Usage dart related_types.dart <entry-point>'); | 32 print('Usage dart related_types.dart <entry-point>'); |
33 } | 33 } |
34 } | 34 } |
35 | 35 |
36 /// Check all loaded libraries in [compiler] for unrelated types. | 36 /// Check all loaded libraries in [compiler] for unrelated types. |
37 void checkRelatedTypes(Compiler compiler) { | 37 void checkRelatedTypes(Compiler compiler) { |
| 38 compiler.openWorld.closeWorld(); |
38 for (LibraryElement library in compiler.libraryLoader.libraries) { | 39 for (LibraryElement library in compiler.libraryLoader.libraries) { |
39 checkLibraryElement(compiler, library); | 40 checkLibraryElement(compiler, library); |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 /// Check [library] for unrelated types. | 44 /// Check [library] for unrelated types. |
44 void checkLibraryElement(Compiler compiler, LibraryElement library) { | 45 void checkLibraryElement(Compiler compiler, LibraryElement library) { |
45 library.forEachLocalMember((Element element) { | 46 library.forEachLocalMember((Element element) { |
46 if (element.isClass) { | 47 if (element.isClass) { |
47 ClassElement cls = element; | 48 ClassElement cls = element; |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 ClassElement findClass(DartType type) => type.accept(this, null); | 411 ClassElement findClass(DartType type) => type.accept(this, null); |
411 | 412 |
412 @override | 413 @override |
413 ClassElement visitType(DartType type, _) => null; | 414 ClassElement visitType(DartType type, _) => null; |
414 | 415 |
415 @override | 416 @override |
416 ClassElement visitInterfaceType(InterfaceType type, _) { | 417 ClassElement visitInterfaceType(InterfaceType type, _) { |
417 return type.element; | 418 return type.element; |
418 } | 419 } |
419 } | 420 } |
OLD | NEW |