| 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 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 _currentElement = element; | 902 _currentElement = element; |
| 903 try { | 903 try { |
| 904 return f(); | 904 return f(); |
| 905 } on SpannableAssertionFailure catch (ex) { | 905 } on SpannableAssertionFailure catch (ex) { |
| 906 if (!hasCrashed) { | 906 if (!hasCrashed) { |
| 907 reportAssertionFailure(ex); | 907 reportAssertionFailure(ex); |
| 908 pleaseReportCrash(); | 908 pleaseReportCrash(); |
| 909 } | 909 } |
| 910 hasCrashed = true; | 910 hasCrashed = true; |
| 911 rethrow; | 911 rethrow; |
| 912 } on StackOverflowError catch (ex) { | 912 } on StackOverflowError { |
| 913 // We cannot report anything useful in this case, because we | 913 // We cannot report anything useful in this case, because we |
| 914 // do not have enough stack space. | 914 // do not have enough stack space. |
| 915 rethrow; | 915 rethrow; |
| 916 } catch (ex) { | 916 } catch (ex) { |
| 917 if (hasCrashed) rethrow; | 917 if (hasCrashed) rethrow; |
| 918 try { | 918 try { |
| 919 unhandledExceptionOnElement(element); | 919 unhandledExceptionOnElement(element); |
| 920 } catch (doubleFault) { | 920 } catch (doubleFault) { |
| 921 // Ignoring exceptions in exception handling. | 921 // Ignoring exceptions in exception handling. |
| 922 } | 922 } |
| (...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 } | 1756 } |
| 1757 for (Element e in new Set.from(resolved)) { | 1757 for (Element e in new Set.from(resolved)) { |
| 1758 if (e.isClass || | 1758 if (e.isClass || |
| 1759 e.isField || | 1759 e.isField || |
| 1760 e.isTypeVariable || | 1760 e.isTypeVariable || |
| 1761 e.isTypedef || | 1761 e.isTypedef || |
| 1762 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { | 1762 identical(e.kind, ElementKind.ABSTRACT_FIELD)) { |
| 1763 resolved.remove(e); | 1763 resolved.remove(e); |
| 1764 } | 1764 } |
| 1765 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { | 1765 if (identical(e.kind, ElementKind.GENERATIVE_CONSTRUCTOR)) { |
| 1766 ClassElement enclosingClass = e.enclosingClass; | |
| 1767 resolved.remove(e); | 1766 resolved.remove(e); |
| 1768 | |
| 1769 } | 1767 } |
| 1770 if (backend.isBackendLibrary(e.library)) { | 1768 if (backend.isBackendLibrary(e.library)) { |
| 1771 resolved.remove(e); | 1769 resolved.remove(e); |
| 1772 } | 1770 } |
| 1773 } | 1771 } |
| 1774 log('Excess resolution work: ${resolved.length}.'); | 1772 log('Excess resolution work: ${resolved.length}.'); |
| 1775 for (Element e in resolved) { | 1773 for (Element e in resolved) { |
| 1776 reportWarning(e, | 1774 reportWarning(e, |
| 1777 MessageKind.GENERIC, | 1775 MessageKind.GENERIC, |
| 1778 {'text': 'Warning: $e resolved but not compiled.'}); | 1776 {'text': 'Warning: $e resolved but not compiled.'}); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 node, messageKind.message(arguments, terseDiagnostics), kind); | 1892 node, messageKind.message(arguments, terseDiagnostics), kind); |
| 1895 } | 1893 } |
| 1896 | 1894 |
| 1897 void reportDiagnostic(Spannable span, | 1895 void reportDiagnostic(Spannable span, |
| 1898 Message message, | 1896 Message message, |
| 1899 api.Diagnostic kind); | 1897 api.Diagnostic kind); |
| 1900 | 1898 |
| 1901 void reportAssertionFailure(SpannableAssertionFailure ex) { | 1899 void reportAssertionFailure(SpannableAssertionFailure ex) { |
| 1902 String message = (ex.message != null) ? tryToString(ex.message) | 1900 String message = (ex.message != null) ? tryToString(ex.message) |
| 1903 : tryToString(ex); | 1901 : tryToString(ex); |
| 1904 SourceSpan span = spanFromSpannable(ex.node); | |
| 1905 reportDiagnosticInternal( | 1902 reportDiagnosticInternal( |
| 1906 ex.node, MessageKind.GENERIC, {'text': message}, api.Diagnostic.CRASH); | 1903 ex.node, MessageKind.GENERIC, {'text': message}, api.Diagnostic.CRASH); |
| 1907 } | 1904 } |
| 1908 | 1905 |
| 1909 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { | 1906 SourceSpan spanFromTokens(Token begin, Token end, [Uri uri]) { |
| 1910 if (begin == null || end == null) { | 1907 if (begin == null || end == null) { |
| 1911 // TODO(ahe): We can almost always do better. Often it is only | 1908 // TODO(ahe): We can almost always do better. Often it is only |
| 1912 // end that is null. Otherwise, we probably know the current | 1909 // end that is null. Otherwise, we probably know the current |
| 1913 // URI. | 1910 // URI. |
| 1914 throw 'Cannot find tokens to produce error message.'; | 1911 throw 'Cannot find tokens to produce error message.'; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2457 return futureClass.computeType(compiler).createInstantiation([elementType]); | 2454 return futureClass.computeType(compiler).createInstantiation([elementType]); |
| 2458 } | 2455 } |
| 2459 | 2456 |
| 2460 @override | 2457 @override |
| 2461 InterfaceType streamType([DartType elementType = const DynamicType()]) { | 2458 InterfaceType streamType([DartType elementType = const DynamicType()]) { |
| 2462 return streamClass.computeType(compiler).createInstantiation([elementType]); | 2459 return streamClass.computeType(compiler).createInstantiation([elementType]); |
| 2463 } | 2460 } |
| 2464 } | 2461 } |
| 2465 | 2462 |
| 2466 typedef void InternalErrorFunction(Spannable location, String message); | 2463 typedef void InternalErrorFunction(Spannable location, String message); |
| OLD | NEW |