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/backend_ast_nodes.dart" : const [" is never "], | 23 "implementation/dart_backend/backend_ast_nodes.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 |
25 // Setlet implements the Set interface: Issue 18959. | 29 // Setlet implements the Set interface: Issue 18959. |
26 "implementation/util/setlet.dart": const [" is never "], | 30 "implementation/util/setlet.dart": const [" is never "], |
27 }; | 31 }; |
28 | 32 |
29 void main() { | 33 void main() { |
30 var uri = currentDirectory.resolve( | 34 var uri = currentDirectory.resolve( |
31 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); | 35 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); |
32 asyncTest(() => analyze([uri], WHITE_LIST, | 36 asyncTest(() => analyze([uri], WHITE_LIST, |
33 analyzeAll: false, checkResults: checkResults)); | 37 analyzeAll: false, checkResults: checkResults)); |
34 } | 38 } |
(...skipping 17 matching lines...) Expand all Loading... |
52 } else if (member.isTypedef) { | 56 } else if (member.isTypedef) { |
53 if (member.isResolved) { | 57 if (member.isResolved) { |
54 compiler.reportHint(member, MessageKind.GENERIC, | 58 compiler.reportHint(member, MessageKind.GENERIC, |
55 {'text': "Helper typedef in production code '$member'."}); | 59 {'text': "Helper typedef in production code '$member'."}); |
56 } | 60 } |
57 } | 61 } |
58 } | 62 } |
59 compiler.libraryLoader.lookupLibrary(helperUri).forEachLocalMember(checkLive); | 63 compiler.libraryLoader.lookupLibrary(helperUri).forEachLocalMember(checkLive); |
60 return handler.checkResults(); | 64 return handler.checkResults(); |
61 } | 65 } |
OLD | NEW |