| 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'dart:uri'; | 8 import 'dart:uri'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; | 10 import '../../../sdk/lib/_internal/compiler/compiler.dart' as api; |
| 11 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; | 11 import '../../../sdk/lib/_internal/compiler/implementation/apiimpl.dart'; |
| 12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 12 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
| 13 hide Compiler; | 13 hide Compiler; |
| 14 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; | 14 import '../../../sdk/lib/_internal/compiler/implementation/filenames.dart'; |
| 15 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; | 15 import '../../../sdk/lib/_internal/compiler/implementation/source_file_provider.
dart'; |
| 16 import '../../../sdk/lib/_internal/libraries.dart'; | 16 import '../../../sdk/lib/_internal/libraries.dart'; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * Map of white-listed warnings and errors. | 19 * Map of white-listed warnings and errors. |
| 20 * | 20 * |
| 21 * Only add a white-listing together with a bug report to dartbug.com and add | 21 * Only add a white-listing together with a bug report to dartbug.com and add |
| 22 * the bug issue number as a comment on the white-listing. | 22 * the bug issue number as a comment on the white-listing. |
| 23 * | 23 * |
| 24 * Use an identifiable suffix of the file uri as key. Use a fixed substring of | 24 * Use an identifiable suffix of the file uri as key. Use a fixed substring of |
| 25 * the error/warning message in the list of white-listings for each file. | 25 * the error/warning message in the list of white-listings for each file. |
| 26 */ | 26 */ |
| 27 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as | 27 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as |
| 28 // values. | 28 // values. |
| 29 const Map<String,List<String>> WHITE_LIST = const { | 29 const Map<String,List<String>> WHITE_LIST = const { |
| 30 'html_dart2js.dart': | 30 'html_dart2js.dart': const ['Warning: Using "new Symbol"', // Issue 10565. |
| 31 const ['Warning: Using "new Symbol"', // Issue 10565. | 31 'Warning: unreachable code'], // Issue 10617. |
| 32 'Warning: unreachable code', // Issue 10617. | |
| 33 // Issue 10688: | |
| 34 'Warning: no property named', | |
| 35 'Warning: WindowBase is not assignable to EventTarget', | |
| 36 "Warning: 'UnsupportedError' is not callable", | |
| 37 "Warning: no method named getBoundingClientRect", | |
| 38 "Warning: no operator [] in class Iterable"], | |
| 39 }; | 32 }; |
| 40 | 33 |
| 41 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { | 34 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
| 42 bool hasWarnings = false; | 35 bool hasWarnings = false; |
| 43 bool hasErrors = false; | 36 bool hasErrors = false; |
| 44 | 37 |
| 45 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>(); | 38 Map<String,Map<String,int>> whiteListMap = new Map<String,Map<String,int>>(); |
| 46 | 39 |
| 47 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) { | 40 CollectingDiagnosticHandler(SourceFileProvider provider) : super(provider) { |
| 48 WHITE_LIST.forEach((String file, List<String> messageParts) { | 41 WHITE_LIST.forEach((String file, List<String> messageParts) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 libraryRoot, libraryRoot, | 126 libraryRoot, libraryRoot, |
| 134 <String>['--analyze-only', '--analyze-all', | 127 <String>['--analyze-only', '--analyze-all', |
| 135 '--categories=Client,Server']); | 128 '--categories=Client,Server']); |
| 136 compiler.librariesToAnalyzeWhenRun = uriList; | 129 compiler.librariesToAnalyzeWhenRun = uriList; |
| 137 compiler.run(null); | 130 compiler.run(null); |
| 138 Expect.isFalse(handler.hasWarnings); | 131 Expect.isFalse(handler.hasWarnings); |
| 139 Expect.isFalse(handler.hasErrors); | 132 Expect.isFalse(handler.hasErrors); |
| 140 Expect.isTrue(handler.checkWhiteListUse()); | 133 Expect.isTrue(handler.checkWhiteListUse()); |
| 141 handler.reportWhiteListUse(); | 134 handler.reportWhiteListUse(); |
| 142 } | 135 } |
| OLD | NEW |