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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of dart2js; 5 part of dart2js;
6 6
7 /** 7 /**
8 * If true, print a warning for each method that was resolved, but not 8 * If true, print a warning for each method that was resolved, but not
9 * compiled. 9 * compiled.
10 */ 10 */
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 () => resolver.resolveSignature(element)); 1615 () => resolver.resolveSignature(element));
1616 } 1616 }
1617 1617
1618 void reportError(Spannable node, 1618 void reportError(Spannable node,
1619 MessageKind messageKind, 1619 MessageKind messageKind,
1620 [Map arguments = const {}]) { 1620 [Map arguments = const {}]) {
1621 reportDiagnosticInternal( 1621 reportDiagnosticInternal(
1622 node, messageKind, arguments, api.Diagnostic.ERROR); 1622 node, messageKind, arguments, api.Diagnostic.ERROR);
1623 } 1623 }
1624 1624
1625 /**
1626 * Reports an error and then aborts the compiler. Avoid using this method.
1627 *
1628 * In order to support incremental compilation, it is preferable to use
1629 * [reportError]. However, care must be taken to leave the compiler in a
1630 * consistent state, for example, by creating synthetic erroneous objects.
1631 *
1632 * If there's absolutely no way to leave the compiler in a consistent state,
1633 * calling this method is preferred as it will set [compilerWasCancelled] to
1634 * true which alerts the incremental compiler to discard all state and start
1635 * a new compiler. Throwing an exception is also better, as this will set
1636 * [hasCrashed] which the incremental compiler also listens too (but don't
1637 * throw exceptions, it creates a really bad user experience).
1638 *
1639 * In any case, calling this method is a last resort, as it essentially
1640 * breaks the user experience of the incremental compiler. The purpose of the
1641 * incremental compiler is to improve developer productivity. Developers
1642 * frequently make mistakes, so syntax errors and spelling errors are
1643 * considered normal to the incremental compiler.
1644 */
1625 void reportFatalError(Spannable node, MessageKind messageKind, 1645 void reportFatalError(Spannable node, MessageKind messageKind,
1626 [Map arguments = const {}]) { 1646 [Map arguments = const {}]) {
1627 reportError(node, messageKind, arguments); 1647 reportError(node, messageKind, arguments);
1628 // TODO(ahe): Make this only abort the current method. 1648 // TODO(ahe): Make this only abort the current method.
1629 throw new CompilerCancelledException( 1649 throw new CompilerCancelledException(
1630 'Error: Cannot continue due to previous error.'); 1650 'Error: Cannot continue due to previous error.');
1631 } 1651 }
1632 1652
1633 void reportWarning(Spannable node, MessageKind messageKind, 1653 void reportWarning(Spannable node, MessageKind messageKind,
1634 [Map arguments = const {}]) { 1654 [Map arguments = const {}]) {
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 static NullSink outputProvider(String name, String extension) { 2073 static NullSink outputProvider(String name, String extension) {
2054 return new NullSink('$name.$extension'); 2074 return new NullSink('$name.$extension');
2055 } 2075 }
2056 } 2076 }
2057 2077
2058 /// Information about suppressed warnings and hints for a given library. 2078 /// Information about suppressed warnings and hints for a given library.
2059 class SuppressionInfo { 2079 class SuppressionInfo {
2060 int warnings = 0; 2080 int warnings = 0;
2061 int hints = 0; 2081 int hints = 0;
2062 } 2082 }
OLDNEW
« 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