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