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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 402593002: Document when (and when not) to use reportFatalError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/sdk/lib/_internal/compiler/implementation/compiler.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
index a08b609bb38773ee24f1b027c123dd8621159ac7..04576357f299fea4b32650de5c9ee61065c6cb5e 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/compiler.dart
@@ -1622,6 +1622,26 @@ abstract class Compiler implements DiagnosticListener {
node, messageKind, arguments, api.Diagnostic.ERROR);
}
+ /**
+ * Reports an error and then aborts the compiler. Avoid using this method.
+ *
+ * In order to support incremental compilation, it is preferable to use
+ * [reportError]. However, care must be taken to leave the compiler in a
+ * consistent state, for example, by creating synthetic erroneous objects.
+ *
+ * If there's absolutely no way to leave the compiler in a consistent state,
+ * calling this method is preferred as it will set [compilerWasCancelled] to
+ * true which alerts the incremental compiler to discard all state and start
+ * a new compiler. Throwing an exception is also better, as this will set
+ * [hasCrashed] which the incremental compiler also listens too (but don't
+ * throw exceptions, it creates a really bad user experience).
+ *
+ * In any case, calling this method is a last resort, as it essentially
+ * breaks the user experience of the incremental compiler. The purpose of the
+ * incremental compiler is to improve developer productivity. Developers
+ * frequently make mistakes, so syntax errors and spelling errors are
+ * considered normal to the incremental compiler.
+ */
void reportFatalError(Spannable node, MessageKind messageKind,
[Map arguments = const {}]) {
reportError(node, messageKind, arguments);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698