| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 Element get currentElement => _currentElement; | 155 Element get currentElement => _currentElement; |
| 156 withCurrentElement(Element element, f()) { | 156 withCurrentElement(Element element, f()) { |
| 157 Element old = currentElement; | 157 Element old = currentElement; |
| 158 _currentElement = element; | 158 _currentElement = element; |
| 159 try { | 159 try { |
| 160 return f(); | 160 return f(); |
| 161 } on SpannableAssertionFailure catch (ex) { | 161 } on SpannableAssertionFailure catch (ex) { |
| 162 if (!hasCrashed) { | 162 if (!hasCrashed) { |
| 163 SourceSpan span = spanFromSpannable(ex.node); | 163 SourceSpan span = spanFromSpannable(ex.node); |
| 164 reportDiagnostic(span, ex.message, api.Diagnostic.ERROR); | 164 reportDiagnostic(span, ex.message, api.Diagnostic.ERROR); |
| 165 pleaseReportCrash(); |
| 165 } | 166 } |
| 166 hasCrashed = true; | 167 hasCrashed = true; |
| 167 throw; | 168 throw; |
| 168 } on CompilerCancelledException catch (ex) { | 169 } on CompilerCancelledException catch (ex) { |
| 169 throw; | 170 throw; |
| 170 } on StackOverflowError catch (ex) { | 171 } on StackOverflowError catch (ex) { |
| 171 // We cannot report anything useful in this case, because we | 172 // We cannot report anything useful in this case, because we |
| 172 // do not have enough stack space. | 173 // do not have enough stack space. |
| 173 throw; | 174 throw; |
| 174 } catch (ex) { | 175 } catch (ex) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 void internalErrorOnElement(Element element, String message) { | 298 void internalErrorOnElement(Element element, String message) { |
| 298 internalError(message, element: element); | 299 internalError(message, element: element); |
| 299 } | 300 } |
| 300 | 301 |
| 301 void unhandledExceptionOnElement(Element element) { | 302 void unhandledExceptionOnElement(Element element) { |
| 302 if (hasCrashed) return; | 303 if (hasCrashed) return; |
| 303 hasCrashed = true; | 304 hasCrashed = true; |
| 304 reportDiagnostic(spanFromElement(element), | 305 reportDiagnostic(spanFromElement(element), |
| 305 MessageKind.COMPILER_CRASHED.error().toString(), | 306 MessageKind.COMPILER_CRASHED.error().toString(), |
| 306 api.Diagnostic.CRASH); | 307 api.Diagnostic.CRASH); |
| 308 pleaseReportCrash(); |
| 309 } |
| 310 |
| 311 void pleaseReportCrash() { |
| 307 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([BUILD_ID])); | 312 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([BUILD_ID])); |
| 308 } | 313 } |
| 309 | 314 |
| 310 void cancel(String reason, {Node node, Token token, | 315 void cancel(String reason, {Node node, Token token, |
| 311 HInstruction instruction, Element element}) { | 316 HInstruction instruction, Element element}) { |
| 312 assembledCode = null; // Compilation failed. Make sure that we | 317 assembledCode = null; // Compilation failed. Make sure that we |
| 313 // don't return a bogus result. | 318 // don't return a bogus result. |
| 314 SourceSpan span = null; | 319 SourceSpan span = null; |
| 315 if (node != null) { | 320 if (node != null) { |
| 316 span = spanFromNode(node); | 321 span = spanFromNode(node); |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 944 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 940 // information on assertion errors. | 945 // information on assertion errors. |
| 941 if (condition is Function){ | 946 if (condition is Function){ |
| 942 condition = condition(); | 947 condition = condition(); |
| 943 } | 948 } |
| 944 if (spannable == null || !condition) { | 949 if (spannable == null || !condition) { |
| 945 throw new SpannableAssertionFailure(spannable, message); | 950 throw new SpannableAssertionFailure(spannable, message); |
| 946 } | 951 } |
| 947 return true; | 952 return true; |
| 948 } | 953 } |
| OLD | NEW |