Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 dart2js.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show | 7 import 'dart:async' show |
| 8 EventSink, | 8 EventSink, |
| 9 Future; | 9 Future; |
| 10 | 10 |
| (...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1243 } | 1243 } |
| 1244 | 1244 |
| 1245 void reportDiagnostic(DiagnosticMessage message, | 1245 void reportDiagnostic(DiagnosticMessage message, |
| 1246 List<DiagnosticMessage> infos, | 1246 List<DiagnosticMessage> infos, |
| 1247 api.Diagnostic kind); | 1247 api.Diagnostic kind); |
| 1248 | 1248 |
| 1249 void reportCrashInUserCode(String message, exception, stackTrace) { | 1249 void reportCrashInUserCode(String message, exception, stackTrace) { |
| 1250 _reporter.onCrashInUserCode(message, exception, stackTrace); | 1250 _reporter.onCrashInUserCode(message, exception, stackTrace); |
| 1251 } | 1251 } |
| 1252 | 1252 |
| 1253 /// Messages for which compile-time errors are reported but compilation | |
| 1254 /// continues regardless. | |
| 1255 static const List<MessageKind> BENIGN_ERRORS = const <MessageKind>[ | |
| 1256 MessageKind.INVALID_METADATA, | |
| 1257 MessageKind.INVALID_METADATA_GENERIC, | |
| 1258 ]; | |
| 1259 | |
| 1260 bool markCompilationAsFailed(DiagnosticMessage message, api.Diagnostic kind) { | |
| 1261 if (testMode) { | |
| 1262 // When in test mode, i.e. on the build-bot, we always stop compilation. | |
| 1263 return true; | |
| 1264 } | |
| 1265 return !BENIGN_ERRORS.contains(message.message.kind); | |
| 1266 } | |
| 1267 | |
| 1268 void fatalDiagnosticReported(DiagnosticMessage message, | |
| 1269 List<DiagnosticMessage> infos, | |
| 1270 api.Diagnostic kind) { | |
| 1271 if (markCompilationAsFailed(message, kind)) { | |
| 1272 compilationFailed = true; | |
| 1273 } | |
| 1274 } | |
| 1275 | |
| 1253 /** | 1276 /** |
| 1254 * Translates the [resolvedUri] into a readable URI. | 1277 * Translates the [resolvedUri] into a readable URI. |
| 1255 * | 1278 * |
| 1256 * The [importingLibrary] holds the library importing [resolvedUri] or | 1279 * The [importingLibrary] holds the library importing [resolvedUri] or |
| 1257 * [:null:] if [resolvedUri] is loaded as the main library. The | 1280 * [:null:] if [resolvedUri] is loaded as the main library. The |
| 1258 * [importingLibrary] is used to grant access to internal libraries from | 1281 * [importingLibrary] is used to grant access to internal libraries from |
| 1259 * platform libraries and patch libraries. | 1282 * platform libraries and patch libraries. |
| 1260 * | 1283 * |
| 1261 * If the [resolvedUri] is not accessible from [importingLibrary], this method | 1284 * If the [resolvedUri] is not accessible from [importingLibrary], this method |
| 1262 * is responsible for reporting errors. | 1285 * is responsible for reporting errors. |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1694 break; | 1717 break; |
| 1695 } | 1718 } |
| 1696 } | 1719 } |
| 1697 lastDiagnosticWasFiltered = false; | 1720 lastDiagnosticWasFiltered = false; |
| 1698 reportDiagnostic(message, infos, kind); | 1721 reportDiagnostic(message, infos, kind); |
| 1699 } | 1722 } |
| 1700 | 1723 |
| 1701 void reportDiagnostic(DiagnosticMessage message, | 1724 void reportDiagnostic(DiagnosticMessage message, |
| 1702 List<DiagnosticMessage> infos, | 1725 List<DiagnosticMessage> infos, |
| 1703 api.Diagnostic kind) { | 1726 api.Diagnostic kind) { |
| 1727 compiler.reportDiagnostic(message, infos, kind); | |
| 1704 if (kind == api.Diagnostic.ERROR || | 1728 if (kind == api.Diagnostic.ERROR || |
| 1705 kind == api.Diagnostic.CRASH || | 1729 kind == api.Diagnostic.CRASH || |
| 1706 (options.fatalWarnings && | 1730 (options.fatalWarnings && |
|
Siggi Cherem (dart-lang)
2015/12/15 00:51:40
maybe benign errors should continue to cause a fai
Johnni Winther
2015/12/15 09:04:20
Done.
| |
| 1707 kind == api.Diagnostic.WARNING)) { | 1731 kind == api.Diagnostic.WARNING)) { |
| 1708 compiler.compilationFailed = true; | 1732 compiler.fatalDiagnosticReported(message, infos, kind); |
| 1709 } | 1733 } |
| 1710 compiler.reportDiagnostic(message, infos, kind); | |
| 1711 } | 1734 } |
| 1712 | 1735 |
| 1713 /** | 1736 /** |
| 1714 * Perform an operation, [f], returning the return value from [f]. If an | 1737 * Perform an operation, [f], returning the return value from [f]. If an |
| 1715 * error occurs then report it as having occurred during compilation of | 1738 * error occurs then report it as having occurred during compilation of |
| 1716 * [element]. Can be nested. | 1739 * [element]. Can be nested. |
| 1717 */ | 1740 */ |
| 1718 withCurrentElement(Element element, f()) { | 1741 withCurrentElement(Element element, f()) { |
| 1719 Element old = currentElement; | 1742 Element old = currentElement; |
| 1720 _currentElement = element; | 1743 _currentElement = element; |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2098 if (_otherDependencies == null) { | 2121 if (_otherDependencies == null) { |
| 2099 _otherDependencies = new Setlet<Element>(); | 2122 _otherDependencies = new Setlet<Element>(); |
| 2100 } | 2123 } |
| 2101 _otherDependencies.add(element.implementation); | 2124 _otherDependencies.add(element.implementation); |
| 2102 } | 2125 } |
| 2103 | 2126 |
| 2104 Iterable<Element> get otherDependencies { | 2127 Iterable<Element> get otherDependencies { |
| 2105 return _otherDependencies != null ? _otherDependencies : const <Element>[]; | 2128 return _otherDependencies != null ? _otherDependencies : const <Element>[]; |
| 2106 } | 2129 } |
| 2107 } | 2130 } |
| OLD | NEW |