Index: tests/compiler/dart2js/analyze_helper.dart |
diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/analyze_helper.dart |
index 58370a7558b6e59726375f653ad872c77be91688..779f389a547892c8f086793b9d83e5c0d711fa34 100644 |
--- a/tests/compiler/dart2js/analyze_helper.dart |
+++ b/tests/compiler/dart2js/analyze_helper.dart |
@@ -9,12 +9,10 @@ import 'dart:io'; |
import 'package:compiler/compiler.dart' as api; |
import 'package:compiler/src/apiimpl.dart'; |
import 'package:compiler/src/commandline_options.dart'; |
-import 'package:compiler/src/diagnostics/messages.dart' show |
- Message, |
- MessageKind; |
+import 'package:compiler/src/diagnostics/messages.dart' |
+ show Message, MessageKind; |
import 'package:compiler/src/filenames.dart'; |
-import 'package:compiler/src/options.dart' show |
- CompilerOptions; |
+import 'package:compiler/src/options.dart' show CompilerOptions; |
import 'package:compiler/src/source_file_provider.dart'; |
import 'package:compiler/src/util/uri_extras.dart'; |
import 'diagnostic_helper.dart'; |
@@ -41,18 +39,18 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
bool lastWasWhitelisted = false; |
bool showWhitelisted = true; |
- Map<String, Map<dynamic/*String|MessageKind*/, int>> whiteListMap |
- = new Map<String, Map<dynamic/*String|MessageKind*/, int>>(); |
+ Map<String, Map<dynamic /*String|MessageKind*/, int>> whiteListMap = |
+ new Map<String, Map<dynamic /*String|MessageKind*/, int>>(); |
List<MessageKind> skipList; |
List<CollectedMessage> collectedMessages = <CollectedMessage>[]; |
CollectingDiagnosticHandler( |
- Map<String, List/*<String|MessageKind>*/> whiteList, |
+ Map<String, List/*<String|MessageKind>*/ > whiteList, |
this.skipList, |
SourceFileProvider provider) |
: super(provider) { |
whiteList.forEach((String file, List/*<String|MessageKind>*/ messageParts) { |
- var useMap = new Map<dynamic/*String|MessageKind*/, int>(); |
+ var useMap = new Map<dynamic /*String|MessageKind*/, int>(); |
for (var messagePart in messageParts) { |
useMap[messagePart] = 0; |
} |
@@ -73,7 +71,7 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
for (var messagePart in whiteListMap[file].keys) { |
if (whiteListMap[file][messagePart] == 0) { |
print("Whitelisting '$messagePart' is unused in '$file'. " |
- "Remove the whitelisting from the whitelist map."); |
+ "Remove the whitelisting from the whitelist map."); |
allUsed = false; |
} |
} |
@@ -87,8 +85,8 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
print('Unexpected messages:'); |
print('----------------------------------------------------------------'); |
for (CollectedMessage message in collectedMessages) { |
- super.report(message.message, message.uri, message.begin, |
- message.end, message.text, message.kind); |
+ super.report(message.message, message.uri, message.begin, message.end, |
+ message.text, message.kind); |
} |
print('----------------------------------------------------------------'); |
} |
@@ -99,7 +97,7 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
for (var messagePart in whiteListMap[file].keys) { |
int useCount = whiteListMap[file][messagePart]; |
print("Whitelisted message '$messagePart' suppressed $useCount " |
- "time(s) in '$file'."); |
+ "time(s) in '$file'."); |
} |
} |
} |
@@ -134,7 +132,7 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
@override |
void report(Message message, Uri uri, int begin, int end, String text, |
- api.Diagnostic kind) { |
+ api.Diagnostic kind) { |
if (kind == api.Diagnostic.WARNING) { |
if (checkWhiteList(uri, message, text)) { |
// Suppress whitelisted warnings. |
@@ -173,24 +171,27 @@ class CollectingDiagnosticHandler extends FormattingDiagnosticHandler { |
} |
lastWasWhitelisted = false; |
if (kind != api.Diagnostic.VERBOSE_INFO) { |
- collectedMessages.add(new CollectedMessage( |
- message, uri, begin, end, text, kind)); |
+ collectedMessages |
+ .add(new CollectedMessage(message, uri, begin, end, text, kind)); |
} |
super.report(message, uri, begin, end, text, kind); |
} |
} |
-typedef bool CheckResults(CompilerImpl compiler, |
- CollectingDiagnosticHandler handler); |
+typedef bool CheckResults( |
+ CompilerImpl compiler, CollectingDiagnosticHandler handler); |
enum AnalysisMode { |
/// Analyze all declarations in all libraries in one go. |
ALL, |
+ |
/// Analyze all declarations in the main library. |
MAIN, |
+ |
/// Analyze all declarations in the given URIs one at a time. This mode can |
/// handle URIs for parts (i.e. skips these). |
URI, |
+ |
/// Analyze all declarations reachable from the entry point. |
TREE_SHAKING, |
} |
@@ -200,12 +201,12 @@ enum AnalysisMode { |
/// |
/// Messages can be generally allowed using [skipList] or on a per-file basis |
/// using [whiteList]. |
-Future analyze(List<Uri> uriList, |
- Map<String, List/*<String|MessageKind>*/> whiteList, |
- {AnalysisMode mode: AnalysisMode.ALL, |
- CheckResults checkResults, |
- List<String> options: const <String>[], |
- List<MessageKind> skipList: const <MessageKind>[]}) async { |
+Future analyze( |
+ List<Uri> uriList, Map<String, List/*<String|MessageKind>*/ > whiteList, |
+ {AnalysisMode mode: AnalysisMode.ALL, |
+ CheckResults checkResults, |
+ List<String> options: const <String>[], |
+ List<MessageKind> skipList: const <MessageKind>[]}) async { |
String testFileName = |
relativize(Uri.base, Platform.script, Platform.isWindows); |
@@ -223,8 +224,11 @@ Future analyze(List<Uri> uriList, |
var packageConfig = currentDirectory.resolve('.packages'); |
var provider = new CompilerSourceFileProvider(); |
var handler = new CollectingDiagnosticHandler(whiteList, skipList, provider); |
- options = <String>[Flags.analyzeOnly, '--categories=Client,Server', |
- Flags.showPackageWarnings]..addAll(options); |
+ options = <String>[ |
+ Flags.analyzeOnly, |
+ '--categories=Client,Server', |
+ Flags.showPackageWarnings |
+ ]..addAll(options); |
switch (mode) { |
case AnalysisMode.URI: |
case AnalysisMode.MAIN: |