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