| 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_api; | 5 library analyze_api; |
| 6 | 6 |
| 7 import 'dart:uri'; | 7 import 'dart:uri'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 9 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; | 10 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; |
| 11 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 11 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| 12 hide Compiler; | 12 hide Compiler; |
| 13 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 13 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| 14 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; | 14 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; |
| 15 import '../../../sdk/lib/_internal/libraries.dart'; | 15 import '../../../sdk/lib/_internal/libraries.dart'; |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Map of white-listed warnings and errors. | 18 * Map of white-listed warnings and errors. |
| 19 * | 19 * |
| 20 * Only add a white-listing together with a bug report to dartbug.com and add | 20 * Only add a white-listing together with a bug report to dartbug.com and add |
| 21 * the bug issue number as a comment on the white-listing. | 21 * the bug issue number as a comment on the white-listing. |
| 22 * | 22 * |
| 23 * Use an identifiable suffix of the file uri as key. Use a fixed substring of | 23 * Use an identifiable suffix of the file uri as key. Use a fixed substring of |
| 24 * the error/warning message in the list of white-listings for each file. | 24 * the error/warning message in the list of white-listings for each file. |
| 25 */ | 25 */ |
| 26 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as | 26 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as |
| 27 // values. | 27 // values. |
| 28 const Map<String,List<String>> WHITE_LIST = const { | 28 const Map<String,List<String>> WHITE_LIST = const { }; |
| 29 'io/http_impl.dart': const ['Warning: no method named'], // Issue 8394. | |
| 30 'io/http_headers.dart': const ['Warning: no method named'], // Issue 8394. | |
| 31 'io/timer_impl.dart': const ['Warning: no method named'], // Issue 8394. | |
| 32 }; | |
| 33 | 29 |
| 34 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { | 30 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
| 35 bool hasWarnings = false; | 31 bool hasWarnings = false; |
| 36 bool hasErrors = false; | 32 bool hasErrors = false; |
| 37 | 33 |
| 38 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>(); | 34 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>(); |
| 39 | 35 |
| 40 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) { | 36 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) { |
| 41 WHITE_LIST.forEach((String file, List<String> messageParts) { | 37 WHITE_LIST.forEach((String file, List<String> messageParts) { |
| 42 var useMap = new Map<String,int>(); | 38 var useMap = new Map<String,int>(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 libraryRoot, libraryRoot, | 120 libraryRoot, libraryRoot, |
| 125 <String>['--analyze-only', '--analyze-all', | 121 <String>['--analyze-only', '--analyze-all', |
| 126 '--categories=Client,Server']); | 122 '--categories=Client,Server']); |
| 127 compiler.librariesToAnalyzeWhenRun = uriList; | 123 compiler.librariesToAnalyzeWhenRun = uriList; |
| 128 compiler.run(null); | 124 compiler.run(null); |
| 129 Expect.isFalse(handler.hasWarnings); | 125 Expect.isFalse(handler.hasWarnings); |
| 130 Expect.isFalse(handler.hasErrors); | 126 Expect.isFalse(handler.hasErrors); |
| 131 Expect.isTrue(handler.checkWhiteListUse()); | 127 Expect.isTrue(handler.checkWhiteListUse()); |
| 132 handler.reportWhiteListUse(); | 128 handler.reportWhiteListUse(); |
| 133 } | 129 } |
| OLD | NEW |