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/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; |
10 import 'package:compiler/src/diagnostics/messages.dart'; | 10 import 'package:compiler/src/diagnostics/messages.dart'; |
11 import 'package:compiler/src/elements/elements.dart' show LibraryElement; | |
12 import 'package:compiler/src/filenames.dart'; | 11 import 'package:compiler/src/filenames.dart'; |
13 | 12 |
14 import 'analyze_helper.dart'; | 13 import 'analyze_helper.dart'; |
15 | 14 |
16 // Do not remove WHITE_LIST even if it's empty. The error message for | 15 // Do not remove WHITE_LIST even if it's empty. The error message for |
17 // unused members refers to WHITE_LIST by name. | 16 // unused members refers to WHITE_LIST by name. |
18 const Map<String, List<String>> WHITE_LIST = const { | 17 const Map<String, List<String>> WHITE_LIST = const { |
19 // Helper methods for debugging should never be called from production code: | 18 // Helper methods for debugging should never be called from production code: |
20 "lib/src/helpers/": const [" is never "], | 19 "lib/src/helpers/": const [" is never "], |
21 | 20 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 member.forEachLocalMember(checkLive); | 73 member.forEachLocalMember(checkLive); |
75 } | 74 } |
76 } else if (member.isTypedef) { | 75 } else if (member.isTypedef) { |
77 if (member.isResolved) { | 76 if (member.isResolved) { |
78 compiler.reporter.reportHintMessage(member, MessageKind.GENERIC, | 77 compiler.reporter.reportHintMessage(member, MessageKind.GENERIC, |
79 {'text': "Helper typedef in production code '$member'."}); | 78 {'text': "Helper typedef in production code '$member'."}); |
80 } | 79 } |
81 } | 80 } |
82 } | 81 } |
83 | 82 |
84 (compiler.libraryLoader.lookupLibrary(helperUri) as LibraryElement) | 83 compiler.libraryLoader.lookupLibrary(helperUri).forEachLocalMember(checkLive); |
85 .forEachLocalMember(checkLive); | |
86 return handler.checkResults(); | 84 return handler.checkResults(); |
87 } | 85 } |
OLD | NEW |