| 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 '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'; | 9 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 10 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 var uri = currentDirectory.resolve( | 28 var uri = currentDirectory.resolve( |
| 29 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); | 29 'sdk/lib/_internal/compiler/implementation/use_unused_api.dart'); |
| 30 asyncTest(() => analyze([uri], WHITE_LIST, | 30 asyncTest(() => analyze([uri], WHITE_LIST, |
| 31 analyzeAll: false, checkResults: checkResults)); | 31 analyzeAll: false, checkResults: checkResults)); |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) { | 34 bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) { |
| 35 var helperUri = currentDirectory.resolve( | 35 var helperUri = currentDirectory.resolve( |
| 36 'sdk/lib/_internal/compiler/implementation/helpers/helpers.dart'); | 36 'sdk/lib/_internal/compiler/implementation/helpers/helpers.dart'); |
| 37 void checkLive(member) { | 37 void checkLive(member) { |
| 38 if (member.isFunction()) { | 38 if (member.isFunction) { |
| 39 if (compiler.enqueuer.resolution.isLive(member)) { | 39 if (compiler.enqueuer.resolution.isLive(member)) { |
| 40 compiler.reportHint(member, MessageKind.GENERIC, | 40 compiler.reportHint(member, MessageKind.GENERIC, |
| 41 {'text': "Helper function in production code '$member'."}); | 41 {'text': "Helper function in production code '$member'."}); |
| 42 } | 42 } |
| 43 } else if (member.isClass()) { | 43 } else if (member.isClass) { |
| 44 if (member.isResolved) { | 44 if (member.isResolved) { |
| 45 compiler.reportHint(member, MessageKind.GENERIC, | 45 compiler.reportHint(member, MessageKind.GENERIC, |
| 46 {'text': "Helper class in production code '$member'."}); | 46 {'text': "Helper class in production code '$member'."}); |
| 47 } else { | 47 } else { |
| 48 member.forEachLocalMember(checkLive); | 48 member.forEachLocalMember(checkLive); |
| 49 } | 49 } |
| 50 } else if (member.isTypedef()) { | 50 } else if (member.isTypedef) { |
| 51 if (member.isResolved) { | 51 if (member.isResolved) { |
| 52 compiler.reportHint(member, MessageKind.GENERIC, | 52 compiler.reportHint(member, MessageKind.GENERIC, |
| 53 {'text': "Helper typedef in production code '$member'."}); | 53 {'text': "Helper typedef in production code '$member'."}); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 compiler.libraries['$helperUri'].forEachLocalMember(checkLive); | 57 compiler.libraries['$helperUri'].forEachLocalMember(checkLive); |
| 58 return handler.checkResults(); | 58 return handler.checkResults(); |
| 59 } | 59 } |
| OLD | NEW |