| 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_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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 whiteListMap[file][messagePart]++; | 89 whiteListMap[file][messagePart]++; |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 return false; | 95 return false; |
| 96 } | 96 } |
| 97 | 97 |
| 98 @override | 98 @override |
| 99 void report(Uri uri, int begin, int end, String message, | 99 void report(Message message, Uri uri, int begin, int end, String text, |
| 100 api.Diagnostic kind) { | 100 api.Diagnostic kind) { |
| 101 if (kind == api.Diagnostic.WARNING) { | 101 if (kind == api.Diagnostic.WARNING) { |
| 102 if (checkWhiteList(uri, message)) { | 102 if (checkWhiteList(uri, text)) { |
| 103 // Suppress whitelisted warnings. | 103 // Suppress whitelisted warnings. |
| 104 lastWasWhitelisted = true; | 104 lastWasWhitelisted = true; |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 hasWarnings = true; | 107 hasWarnings = true; |
| 108 } | 108 } |
| 109 if (kind == api.Diagnostic.HINT) { | 109 if (kind == api.Diagnostic.HINT) { |
| 110 if (checkWhiteList(uri, message)) { | 110 if (checkWhiteList(uri, text)) { |
| 111 // Suppress whitelisted hints. | 111 // Suppress whitelisted hints. |
| 112 lastWasWhitelisted = true; | 112 lastWasWhitelisted = true; |
| 113 return; | 113 return; |
| 114 } | 114 } |
| 115 hasHint = true; | 115 hasHint = true; |
| 116 } | 116 } |
| 117 if (kind == api.Diagnostic.ERROR) { | 117 if (kind == api.Diagnostic.ERROR) { |
| 118 if (checkWhiteList(uri, message)) { | 118 if (checkWhiteList(uri, text)) { |
| 119 // Suppress whitelisted errors. | 119 // Suppress whitelisted errors. |
| 120 lastWasWhitelisted = true; | 120 lastWasWhitelisted = true; |
| 121 return; | 121 return; |
| 122 } | 122 } |
| 123 hasErrors = true; | 123 hasErrors = true; |
| 124 } | 124 } |
| 125 if (kind == api.Diagnostic.INFO && lastWasWhitelisted) { | 125 if (kind == api.Diagnostic.INFO && lastWasWhitelisted) { |
| 126 return; | 126 return; |
| 127 } | 127 } |
| 128 lastWasWhitelisted = false; | 128 lastWasWhitelisted = false; |
| 129 super.report(uri, begin, end, message, kind); | 129 super.report(message, uri, begin, end, text, kind); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 typedef bool CheckResults(Compiler compiler, | 133 typedef bool CheckResults(Compiler compiler, |
| 134 CollectingDiagnosticHandler handler); | 134 CollectingDiagnosticHandler handler); |
| 135 | 135 |
| 136 Future analyze(List<Uri> uriList, | 136 Future analyze(List<Uri> uriList, |
| 137 Map<String, List<String>> whiteList, | 137 Map<String, List<String>> whiteList, |
| 138 {bool analyzeAll: true, | 138 {bool analyzeAll: true, |
| 139 CheckResults checkResults}) { | 139 CheckResults checkResults}) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 exit(1); | 188 exit(1); |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 if (analyzeAll) { | 191 if (analyzeAll) { |
| 192 compiler.librariesToAnalyzeWhenRun = uriList; | 192 compiler.librariesToAnalyzeWhenRun = uriList; |
| 193 return compiler.run(null).then(onCompletion); | 193 return compiler.run(null).then(onCompletion); |
| 194 } else { | 194 } else { |
| 195 return compiler.run(uriList.single).then(onCompletion); | 195 return compiler.run(uriList.single).then(onCompletion); |
| 196 } | 196 } |
| 197 } | 197 } |
| OLD | NEW |