Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: tests/compiler/dart2js/analyze_helper.dart

Issue 2939063002: Strong mode cleaning of many dart2js tests. (Closed)
Patch Set: Use ClassElement. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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_helper; 5 library analyze_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'package:compiler/compiler.dart' as api; 9 import 'package:compiler/compiler.dart' as api;
10 import 'package:compiler/src/apiimpl.dart'; 10 import 'package:compiler/src/apiimpl.dart';
(...skipping 21 matching lines...) Expand all
32 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as 32 // TODO(johnniwinther): Support canonical URIs as keys and message kinds as
33 // values. 33 // values.
34 34
35 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { 35 class CollectingDiagnosticHandler extends FormattingDiagnosticHandler {
36 bool hasWarnings = false; 36 bool hasWarnings = false;
37 bool hasHint = false; 37 bool hasHint = false;
38 bool hasErrors = false; 38 bool hasErrors = false;
39 bool lastWasWhitelisted = false; 39 bool lastWasWhitelisted = false;
40 bool showWhitelisted = true; 40 bool showWhitelisted = true;
41 41
42 Map<String, Map<dynamic /*String|MessageKind*/, int>> whiteListMap = 42 Map<String, Map<dynamic /* String|MessageKind */, int>> whiteListMap =
43 new Map<String, Map<dynamic /*String|MessageKind*/, int>>(); 43 new Map<String, Map<dynamic /* String|MessageKind */, int>>();
44 List<MessageKind> skipList; 44 List<MessageKind> skipList;
45 List<CollectedMessage> collectedMessages = <CollectedMessage>[]; 45 List<CollectedMessage> collectedMessages = <CollectedMessage>[];
46 46
47 CollectingDiagnosticHandler( 47 CollectingDiagnosticHandler(
48 Map<String, List/*<String|MessageKind>*/ > whiteList, 48 Map<String, List /* <String|MessageKind> */ > whiteList,
49 this.skipList, 49 this.skipList,
50 SourceFileProvider provider) 50 SourceFileProvider provider)
51 : super(provider) { 51 : super(provider) {
52 whiteList.forEach((String file, List/*<String|MessageKind>*/ messageParts) { 52 whiteList
53 var useMap = new Map<dynamic /*String|MessageKind*/, int>(); 53 .forEach((String file, List /* <String|MessageKind> */ messageParts) {
54 var useMap = new Map<dynamic /* String|MessageKind */, int>();
54 for (var messagePart in messageParts) { 55 for (var messagePart in messageParts) {
55 useMap[messagePart] = 0; 56 useMap[messagePart] = 0;
56 } 57 }
57 whiteListMap[file] = useMap; 58 whiteListMap[file] = useMap;
58 }); 59 });
59 } 60 }
60 61
61 bool checkResults() { 62 bool checkResults() {
62 bool validWhiteListUse = checkWhiteListUse(); 63 bool validWhiteListUse = checkWhiteListUse();
63 reportWhiteListUse(); 64 reportWhiteListUse();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 /// Analyze all declarations reachable from the entry point. 196 /// Analyze all declarations reachable from the entry point.
196 TREE_SHAKING, 197 TREE_SHAKING,
197 } 198 }
198 199
199 /// Analyzes the file(s) in [uriList] using the provided [mode] and checks that 200 /// Analyzes the file(s) in [uriList] using the provided [mode] and checks that
200 /// no messages (errors, warnings or hints) are emitted. 201 /// no messages (errors, warnings or hints) are emitted.
201 /// 202 ///
202 /// Messages can be generally allowed using [skipList] or on a per-file basis 203 /// Messages can be generally allowed using [skipList] or on a per-file basis
203 /// using [whiteList]. 204 /// using [whiteList].
204 Future analyze( 205 Future analyze(
205 List<Uri> uriList, Map<String, List/*<String|MessageKind>*/ > whiteList, 206 List<Uri> uriList, Map<String, List /* <String|MessageKind> */ > whiteList,
206 {AnalysisMode mode: AnalysisMode.ALL, 207 {AnalysisMode mode: AnalysisMode.ALL,
207 CheckResults checkResults, 208 CheckResults checkResults,
208 List<String> options: const <String>[], 209 List<String> options: const <String>[],
209 List<MessageKind> skipList: const <MessageKind>[]}) async { 210 List<MessageKind> skipList: const <MessageKind>[]}) async {
210 String testFileName = 211 String testFileName =
211 relativize(Uri.base, Platform.script, Platform.isWindows); 212 relativize(Uri.base, Platform.script, Platform.isWindows);
212 213
213 print(""" 214 print("""
214 215
215 216
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 if (checkResults != null) { 284 if (checkResults != null) {
284 result = checkResults(compiler, handler); 285 result = checkResults(compiler, handler);
285 } else { 286 } else {
286 result = handler.checkResults(); 287 result = handler.checkResults();
287 } 288 }
288 if (!result) { 289 if (!result) {
289 print(MESSAGE); 290 print(MESSAGE);
290 exit(1); 291 exit(1);
291 } 292 }
292 } 293 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698