Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: test/dart_codegen/expect/core/exceptions.dart

Issue 1148283010: Remove dart backend (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/dart_codegen/expect/core/errors.dart ('k') | test/dart_codegen/expect/core/expando.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 part of dart.core;
2 abstract class Exception {factory Exception([var message]) => new _ExceptionImp lementation(message);
3 }
4 class _ExceptionImplementation implements Exception {final message;
5 _ExceptionImplementation([this.message]);
6 String toString() {
7 if (message == null) return "Exception";
8 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 > DEVC$RT.cast(source.length, dynamic , num, "DynamicCast", """line 108, column 49 of dart:core/exceptions.dart: """, source.length is num, true))) {
28 offset = -1;
29 }
30 if (offset == -1) {
31 String source = ((__x3) => DEVC$RT.cast(__x3, dynamic, String, "DynamicCast", "" "line 113, column 23 of dart:core/exceptions.dart: """, __x3 is String, true))(t his.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; i < offset; i++) {
41 int char = ((__x4) => DEVC$RT.cast(__x4, dynamic, int, "DynamicCast", """line 12 3, column 18 of dart:core/exceptions.dart: """, __x4 is int, true))(source.codeU nitAt(i));
42 if (char == 0x0a) {
43 if (lineStart != i || !lastWasCR) {
44 lineNum++;
45 }
46 lineStart = i + 1;
47 lastWasCR = false;
48 }
49 else if (char == 0x0d) {
50 lineNum++;
51 lineStart = i + 1;
52 lastWasCR = true;
53 }
54 }
55 if (lineNum > 1) {
56 report += " (at line $lineNum, character ${offset - lineStart + 1})\n";
57 }
58 else {
59 report += " (at character ${offset + 1})\n";
60 }
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 < DEVC$RT.cast(source.length, dynamic, num, "DynamicCast ", """line 142, column 30 of dart:core/exceptions.dart: """, source.length is nu m, true); i++) {
63 int char = ((__x5) => DEVC$RT.cast(__x5, dynamic, int, "DynamicCast", """line 14 3, column 18 of dart:core/exceptions.dart: """, __x5 is int, true))(source.codeU nitAt(i));
64 if (char == 0x0a || char == 0x0d) {
65 lineEnd = i;
66 break;
67 }
68 }
69 int length = lineEnd - lineStart;
70 int start = lineStart;
71 int end = lineEnd;
72 String prefix = "";
73 String postfix = "";
74 if (length > 78) {
75 int index = offset - lineStart;
76 if (index < 75) {
77 end = start + 75;
78 postfix = "...";
79 }
80 else if (end - offset < 75) {
81 start = end - 75;
82 prefix = "...";
83 }
84 else {
85 start = offset - 36;
86 end = offset + 36;
87 prefix = postfix = "...";
88 }
89 }
90 String slice = ((__x6) => DEVC$RT.cast(__x6, dynamic, String, "DynamicCast", "" "line 171, column 20 of dart:core/exceptions.dart: """, __x6 is String, true))(s ource.substring(start, end));
91 int markOffset = offset - start + prefix.length;
92 return "$report$prefix$slice$postfix\n${" " * markOffset}^\n";
93 }
94 }
95 class IntegerDivisionByZeroException implements Exception {const IntegerDivisio nByZeroException();
96 String toString() => "IntegerDivisionByZeroException";
97 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/core/errors.dart ('k') | test/dart_codegen/expect/core/expando.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698