| OLD | NEW |
| 1 part of dart.core; | 1 part of dart.core; |
| 2 | 2 |
| 3 abstract class Exception { | 3 abstract class Exception { |
| 4 factory Exception([var message]) => new _ExceptionImplementation(message); | 4 factory Exception([var message]) => new _ExceptionImplementation(message); |
| 5 } | 5 } |
| 6 class _ExceptionImplementation implements Exception { | 6 class _ExceptionImplementation implements Exception { |
| 7 final message; | 7 final message; |
| 8 _ExceptionImplementation([this.message]); | 8 _ExceptionImplementation([this.message]); |
| 9 String toString() { | 9 String toString() { |
| 10 if (message == null) return "Exception"; | 10 if (message == null) return "Exception"; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 if (source is! String) { | 25 if (source is! String) { |
| 26 if (offset != -1) { | 26 if (offset != -1) { |
| 27 report += " (at offset $offset)"; | 27 report += " (at offset $offset)"; |
| 28 } | 28 } |
| 29 return report; | 29 return report; |
| 30 } | 30 } |
| 31 if (offset != -1 && (offset < 0 || offset > source.length)) { | 31 if (offset != -1 && (offset < 0 || offset > source.length)) { |
| 32 offset = -1; | 32 offset = -1; |
| 33 } | 33 } |
| 34 if (offset == -1) { | 34 if (offset == -1) { |
| 35 String source = ((__x17) => DDC$RT.cast(__x17, dynamic, String, | 35 String source = ((__x3) => DDC$RT.cast(__x3, dynamic, String, |
| 36 "CastGeneral", | 36 "CastGeneral", |
| 37 """line 113, column 23 of dart:core/exceptions.dart: """, | 37 """line 113, column 23 of dart:core/exceptions.dart: """, |
| 38 __x17 is String, true))(this.source); | 38 __x3 is String, true))(this.source); |
| 39 if (source.length > 78) { | 39 if (source.length > 78) { |
| 40 source = source.substring(0, 75) + "..."; | 40 source = source.substring(0, 75) + "..."; |
| 41 } | 41 } |
| 42 return "$report\n$source"; | 42 return "$report\n$source"; |
| 43 } | 43 } |
| 44 int lineNum = 1; | 44 int lineNum = 1; |
| 45 int lineStart = 0; | 45 int lineStart = 0; |
| 46 bool lastWasCR; | 46 bool lastWasCR; |
| 47 for (int i = 0; i < offset; i++) { | 47 for (int i = 0; i < offset; i++) { |
| 48 int char = ((__x18) => DDC$RT.cast(__x18, dynamic, int, "CastGeneral", | 48 int char = ((__x4) => DDC$RT.cast(__x4, dynamic, int, "CastGeneral", |
| 49 """line 123, column 18 of dart:core/exceptions.dart: """, | 49 """line 123, column 18 of dart:core/exceptions.dart: """, __x4 is int, |
| 50 __x18 is int, true))(source.codeUnitAt(i)); | 50 true))(source.codeUnitAt(i)); |
| 51 if (char == 0x0a) { | 51 if (char == 0x0a) { |
| 52 if (lineStart != i || !lastWasCR) { | 52 if (lineStart != i || !lastWasCR) { |
| 53 lineNum++; | 53 lineNum++; |
| 54 } | 54 } |
| 55 lineStart = i + 1; | 55 lineStart = i + 1; |
| 56 lastWasCR = false; | 56 lastWasCR = false; |
| 57 } else if (char == 0x0d) { | 57 } else if (char == 0x0d) { |
| 58 lineNum++; | 58 lineNum++; |
| 59 lineStart = i + 1; | 59 lineStart = i + 1; |
| 60 lastWasCR = true; | 60 lastWasCR = true; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 if (lineNum > 1) { | 63 if (lineNum > 1) { |
| 64 report += " (at line $lineNum, character ${offset - lineStart + 1})\n"; | 64 report += " (at line $lineNum, character ${offset - lineStart + 1})\n"; |
| 65 } else { | 65 } else { |
| 66 report += " (at character ${offset + 1})\n"; | 66 report += " (at character ${offset + 1})\n"; |
| 67 } | 67 } |
| 68 int lineEnd = DDC$RT.cast(source.length, dynamic, int, "CastGeneral", | 68 int lineEnd = DDC$RT.cast(source.length, dynamic, int, "CastGeneral", |
| 69 """line 141, column 19 of dart:core/exceptions.dart: """, | 69 """line 141, column 19 of dart:core/exceptions.dart: """, |
| 70 source.length is int, true); | 70 source.length is int, true); |
| 71 for (int i = offset; i < source.length; i++) { | 71 for (int i = offset; i < source.length; i++) { |
| 72 int char = ((__x19) => DDC$RT.cast(__x19, dynamic, int, "CastGeneral", | 72 int char = ((__x5) => DDC$RT.cast(__x5, dynamic, int, "CastGeneral", |
| 73 """line 143, column 18 of dart:core/exceptions.dart: """, | 73 """line 143, column 18 of dart:core/exceptions.dart: """, __x5 is int, |
| 74 __x19 is int, true))(source.codeUnitAt(i)); | 74 true))(source.codeUnitAt(i)); |
| 75 if (char == 0x0a || char == 0x0d) { | 75 if (char == 0x0a || char == 0x0d) { |
| 76 lineEnd = i; | 76 lineEnd = i; |
| 77 break; | 77 break; |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 int length = lineEnd - lineStart; | 80 int length = lineEnd - lineStart; |
| 81 int start = lineStart; | 81 int start = lineStart; |
| 82 int end = lineEnd; | 82 int end = lineEnd; |
| 83 String prefix = ""; | 83 String prefix = ""; |
| 84 String postfix = ""; | 84 String postfix = ""; |
| 85 if (length > 78) { | 85 if (length > 78) { |
| 86 int index = offset - lineStart; | 86 int index = offset - lineStart; |
| 87 if (index < 75) { | 87 if (index < 75) { |
| 88 end = start + 75; | 88 end = start + 75; |
| 89 postfix = "..."; | 89 postfix = "..."; |
| 90 } else if (end - offset < 75) { | 90 } else if (end - offset < 75) { |
| 91 start = end - 75; | 91 start = end - 75; |
| 92 prefix = "..."; | 92 prefix = "..."; |
| 93 } else { | 93 } else { |
| 94 start = offset - 36; | 94 start = offset - 36; |
| 95 end = offset + 36; | 95 end = offset + 36; |
| 96 prefix = postfix = "..."; | 96 prefix = postfix = "..."; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 String slice = ((__x20) => DDC$RT.cast(__x20, dynamic, String, | 99 String slice = ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGeneral", |
| 100 "CastGeneral", """line 171, column 20 of dart:core/exceptions.dart: """, | 100 """line 171, column 20 of dart:core/exceptions.dart: """, |
| 101 __x20 is String, true))(source.substring(start, end)); | 101 __x6 is String, true))(source.substring(start, end)); |
| 102 int markOffset = offset - start + prefix.length; | 102 int markOffset = offset - start + prefix.length; |
| 103 return "$report$prefix$slice$postfix\n${" " * markOffset}^\n"; | 103 return "$report$prefix$slice$postfix\n${" " * markOffset}^\n"; |
| 104 } | 104 } |
| 105 } | 105 } |
| 106 class IntegerDivisionByZeroException implements Exception { | 106 class IntegerDivisionByZeroException implements Exception { |
| 107 const IntegerDivisionByZeroException(); | 107 const IntegerDivisionByZeroException(); |
| 108 String toString() => "IntegerDivisionByZeroException"; | 108 String toString() => "IntegerDivisionByZeroException"; |
| 109 } | 109 } |
| OLD | NEW |