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

Side by Side Diff: dart/pkg/compiler/lib/src/compiler.dart

Issue 791263003: Remove Compiler.reportFatalError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: One more crash revealed. Created 6 years 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
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 1774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 backend.codegen(work); 1785 backend.codegen(work);
1786 } 1786 }
1787 1787
1788 void reportError(Spannable node, 1788 void reportError(Spannable node,
1789 MessageKind messageKind, 1789 MessageKind messageKind,
1790 [Map arguments = const {}]) { 1790 [Map arguments = const {}]) {
1791 reportDiagnosticInternal( 1791 reportDiagnosticInternal(
1792 node, messageKind, arguments, api.Diagnostic.ERROR); 1792 node, messageKind, arguments, api.Diagnostic.ERROR);
1793 } 1793 }
1794 1794
1795 /**
1796 * Reports an error and then aborts the compiler. Avoid using this method.
1797 *
1798 * In order to support incremental compilation, it is preferable to use
1799 * [reportError]. However, care must be taken to leave the compiler in a
1800 * consistent state, for example, by creating synthetic erroneous objects.
1801 *
1802 * If there's absolutely no way to leave the compiler in a consistent state,
1803 * calling this method is preferred as it will set [compilerWasCancelled] to
1804 * true which alerts the incremental compiler to discard all state and start
1805 * a new compiler. Throwing an exception is also better, as this will set
1806 * [hasCrashed] which the incremental compiler also listens too (but don't
1807 * throw exceptions, it creates a really bad user experience).
1808 *
1809 * In any case, calling this method is a last resort, as it essentially
1810 * breaks the user experience of the incremental compiler. The purpose of the
1811 * incremental compiler is to improve developer productivity. Developers
1812 * frequently make mistakes, so syntax errors and spelling errors are
1813 * considered normal to the incremental compiler.
1814 */
1815 void reportFatalError(Spannable node, MessageKind messageKind,
1816 [Map arguments = const {}]) {
1817 reportError(node, messageKind, arguments);
1818 // TODO(ahe): Make this only abort the current method.
1819 throw new CompilerCancelledException(
1820 'Error: Cannot continue due to previous error.');
1821 }
1822
1823 void reportWarning(Spannable node, MessageKind messageKind, 1795 void reportWarning(Spannable node, MessageKind messageKind,
1824 [Map arguments = const {}]) { 1796 [Map arguments = const {}]) {
1825 reportDiagnosticInternal( 1797 reportDiagnosticInternal(
1826 node, messageKind, arguments, api.Diagnostic.WARNING); 1798 node, messageKind, arguments, api.Diagnostic.WARNING);
1827 } 1799 }
1828 1800
1829 void reportInfo(Spannable node, MessageKind messageKind, 1801 void reportInfo(Spannable node, MessageKind messageKind,
1830 [Map arguments = const {}]) { 1802 [Map arguments = const {}]) {
1831 reportDiagnosticInternal(node, messageKind, arguments, api.Diagnostic.INFO); 1803 reportDiagnosticInternal(node, messageKind, arguments, api.Diagnostic.INFO);
1832 } 1804 }
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 InterfaceType get nullType => nullClass.computeType(compiler); 2380 InterfaceType get nullType => nullClass.computeType(compiler);
2409 2381
2410 @override 2382 @override
2411 InterfaceType get numType => numClass.computeType(compiler); 2383 InterfaceType get numType => numClass.computeType(compiler);
2412 2384
2413 @override 2385 @override
2414 InterfaceType get stringType => stringClass.computeType(compiler); 2386 InterfaceType get stringType => stringClass.computeType(compiler);
2415 } 2387 }
2416 2388
2417 typedef void InternalErrorFunction(Spannable location, String message); 2389 typedef void InternalErrorFunction(Spannable location, String message);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698