OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 analyze_unused_dart2js; | 5 library analyze_unused_dart2js; |
6 | 6 |
7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 | 8 |
9 import 'package:compiler/implementation/dart2jslib.dart'; | 9 import 'package:compiler/implementation/dart2jslib.dart'; |
10 import 'package:compiler/implementation/filenames.dart'; | 10 import 'package:compiler/implementation/filenames.dart'; |
11 | 11 |
12 import 'analyze_helper.dart'; | 12 import 'analyze_helper.dart'; |
13 | 13 |
14 // Do not remove WHITE_LIST even if it's empty. The error message for | 14 // Do not remove WHITE_LIST even if it's empty. The error message for |
15 // unused members refers to WHITE_LIST by name. | 15 // unused members refers to WHITE_LIST by name. |
16 const Map<String, List<String>> WHITE_LIST = const { | 16 const Map<String, List<String>> WHITE_LIST = const { |
17 // TODO(johnniwinther): Explicitly check that we use no helpers, both methods | 17 // TODO(johnniwinther): Explicitly check that we use no helpers, both methods |
18 // and classes, are used in production code.*/ | 18 // and classes, are used in production code.*/ |
19 // Helper methods for debugging should never be called from production code: | 19 // Helper methods for debugging should never be called from production code: |
20 "implementation/helpers/": const [" is never "], | 20 "implementation/helpers/": const [" is never "], |
21 | 21 |
22 // Some things in dart_printer are not yet used | 22 // Some things in dart_printer are not yet used |
23 "implementation/dart_backend/dart_printer.dart" : const [" is never "], | 23 "implementation/dart_backend/dart_printer.dart" : const [" is never "], |
24 | 24 |
25 // dart2js uses only the encoding functions, the decoding functions are used | |
26 // from the generated code. | |
27 "implementation/runtime_data.dart": const [" is never "], | |
28 | |
29 // Setlet implements the Set interface: Issue 18959. | 25 // Setlet implements the Set interface: Issue 18959. |
30 "implementation/util/setlet.dart": const [" is never "], | 26 "implementation/util/setlet.dart": const [" is never "], |
31 }; | 27 }; |
32 | 28 |
33 void main() { | 29 void main() { |
34 var uri = currentDirectory.resolve( | 30 var uri = currentDirectory.resolve( |
35 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); | 31 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); |
36 asyncTest(() => analyze([uri], WHITE_LIST, | 32 asyncTest(() => analyze([uri], WHITE_LIST, |
37 analyzeAll: false, checkResults: checkResults)); | 33 analyzeAll: false, checkResults: checkResults)); |
38 } | 34 } |
(...skipping 17 matching lines...) Expand all Loading... |
56 } else if (member.isTypedef) { | 52 } else if (member.isTypedef) { |
57 if (member.isResolved) { | 53 if (member.isResolved) { |
58 compiler.reportHint(member, MessageKind.GENERIC, | 54 compiler.reportHint(member, MessageKind.GENERIC, |
59 {'text': "Helper typedef in production code '$member'."}); | 55 {'text': "Helper typedef in production code '$member'."}); |
60 } | 56 } |
61 } | 57 } |
62 } | 58 } |
63 compiler.libraryLoader.lookupLibrary(helperUri).forEachLocalMember(checkLive); | 59 compiler.libraryLoader.lookupLibrary(helperUri).forEachLocalMember(checkLive); |
64 return handler.checkResults(); | 60 return handler.checkResults(); |
65 } | 61 } |
OLD | NEW |