| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 span = spanFromHInstruction(instruction); | 421 span = spanFromHInstruction(instruction); |
| 422 } else if (element != null) { | 422 } else if (element != null) { |
| 423 span = spanFromElement(element); | 423 span = spanFromElement(element); |
| 424 } else { | 424 } else { |
| 425 throw 'No error location for error: $reason'; | 425 throw 'No error location for error: $reason'; |
| 426 } | 426 } |
| 427 reportDiagnostic(span, reason, api.Diagnostic.ERROR); | 427 reportDiagnostic(span, reason, api.Diagnostic.ERROR); |
| 428 throw new CompilerCancelledException(reason); | 428 throw new CompilerCancelledException(reason); |
| 429 } | 429 } |
| 430 | 430 |
| 431 SourceSpan spanFromSpannable(Spannable node) { | 431 SourceSpan spanFromSpannable(Spannable node, [Uri uri]) { |
| 432 if (node is Node) { | 432 if (node is Node) { |
| 433 return spanFromNode(node); | 433 return spanFromNode(node, uri); |
| 434 } else if (node is Token) { | 434 } else if (node is Token) { |
| 435 return spanFromTokens(node, node); | 435 return spanFromTokens(node, node, uri); |
| 436 } else if (node is HInstruction) { | 436 } else if (node is HInstruction) { |
| 437 return spanFromHInstruction(node); | 437 return spanFromHInstruction(node); |
| 438 } else if (node is Element) { | 438 } else if (node is Element) { |
| 439 return spanFromElement(node); | 439 return spanFromElement(node); |
| 440 } else { | 440 } else { |
| 441 throw 'No error location.'; | 441 throw 'No error location.'; |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 void reportFatalError(String reason, Element element, | 445 void reportFatalError(String reason, Element element, |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 // TODO(johnniwinther): Use [spannable] and [message] to provide better | 1078 // TODO(johnniwinther): Use [spannable] and [message] to provide better |
| 1079 // information on assertion errors. | 1079 // information on assertion errors. |
| 1080 if (condition is Function){ | 1080 if (condition is Function){ |
| 1081 condition = condition(); | 1081 condition = condition(); |
| 1082 } | 1082 } |
| 1083 if (spannable == null || !condition) { | 1083 if (spannable == null || !condition) { |
| 1084 throw new SpannableAssertionFailure(spannable, message); | 1084 throw new SpannableAssertionFailure(spannable, message); |
| 1085 } | 1085 } |
| 1086 return true; | 1086 return true; |
| 1087 } | 1087 } |
| OLD | NEW |