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

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

Issue 959073002: Fix new line breaks on } (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 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/list.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 19 matching lines...) Expand all
30 if (offset == -1) { 30 if (offset == -1) {
31 String source = ((__x3) => DDC$RT.cast(__x3, dynamic, String, "CastGeneral", """ line 113, column 23 of dart:core/exceptions.dart: """, __x3 is String, true))(th is.source); 31 String source = ((__x3) => DDC$RT.cast(__x3, dynamic, String, "CastGeneral", """ line 113, column 23 of dart:core/exceptions.dart: """, __x3 is String, true))(th is.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; 40 for (int i = 0; i < offset; i++) {
41 i < offset;
42 i++) {
43 int char = ((__x4) => DDC$RT.cast(__x4, dynamic, int, "CastGeneral", """line 123 , column 18 of dart:core/exceptions.dart: """, __x4 is int, true))(source.codeUn itAt(i)); 41 int char = ((__x4) => DDC$RT.cast(__x4, dynamic, int, "CastGeneral", """line 123 , column 18 of dart:core/exceptions.dart: """, __x4 is int, true))(source.codeUn itAt(i));
44 if (char == 0x0a) { 42 if (char == 0x0a) {
45 if (lineStart != i || !lastWasCR) { 43 if (lineStart != i || !lastWasCR) {
46 lineNum++; 44 lineNum++;
47 } 45 }
48 lineStart = i + 1; 46 lineStart = i + 1;
49 lastWasCR = false; 47 lastWasCR = false;
50 } 48 }
51 else if (char == 0x0d) { 49 else if (char == 0x0d) {
52 lineNum++; 50 lineNum++;
53 lineStart = i + 1; 51 lineStart = i + 1;
54 lastWasCR = true; 52 lastWasCR = true;
55 } 53 }
56 } 54 }
57 if (lineNum > 1) { 55 if (lineNum > 1) {
58 report += " (at line $lineNum, character ${offset - lineStart + 1} 56 report += " (at line $lineNum, character ${offset - lineStart + 1})\n";
59 )\n";
60 } 57 }
61 else { 58 else {
62 report += " (at character ${offset + 1} 59 report += " (at character ${offset + 1})\n";
63 )\n";
64 } 60 }
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); 61 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; 62 for (int i = offset; i < source.length; i++) {
67 i < source.length;
68 i++) {
69 int char = ((__x5) => DDC$RT.cast(__x5, dynamic, int, "CastGeneral", """line 143 , column 18 of dart:core/exceptions.dart: """, __x5 is int, true))(source.codeUn itAt(i)); 63 int char = ((__x5) => DDC$RT.cast(__x5, dynamic, int, "CastGeneral", """line 143 , column 18 of dart:core/exceptions.dart: """, __x5 is int, true))(source.codeUn itAt(i));
70 if (char == 0x0a || char == 0x0d) { 64 if (char == 0x0a || char == 0x0d) {
71 lineEnd = i; 65 lineEnd = i;
72 break; 66 break;
73 } 67 }
74 } 68 }
75 int length = lineEnd - lineStart; 69 int length = lineEnd - lineStart;
76 int start = lineStart; 70 int start = lineStart;
77 int end = lineEnd; 71 int end = lineEnd;
78 String prefix = ""; 72 String prefix = "";
79 String postfix = ""; 73 String postfix = "";
80 if (length > 78) { 74 if (length > 78) {
81 int index = offset - lineStart; 75 int index = offset - lineStart;
82 if (index < 75) { 76 if (index < 75) {
83 end = start + 75; 77 end = start + 75;
84 postfix = "..."; 78 postfix = "...";
85 } 79 }
86 else if (end - offset < 75) { 80 else if (end - offset < 75) {
87 start = end - 75; 81 start = end - 75;
88 prefix = "..."; 82 prefix = "...";
89 } 83 }
90 else { 84 else {
91 start = offset - 36; 85 start = offset - 36;
92 end = offset + 36; 86 end = offset + 36;
93 prefix = postfix = "..."; 87 prefix = postfix = "...";
94 } 88 }
95 } 89 }
96 String slice = ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGeneral", """ line 171, column 20 of dart:core/exceptions.dart: """, __x6 is String, true))(so urce.substring(start, end)); 90 String slice = ((__x6) => DDC$RT.cast(__x6, dynamic, String, "CastGeneral", """ line 171, column 20 of dart:core/exceptions.dart: """, __x6 is String, true))(so urce.substring(start, end));
97 int markOffset = offset - start + prefix.length; 91 int markOffset = offset - start + prefix.length;
98 return "$report$prefix$slice$postfix\n${" " * markOffset} 92 return "$report$prefix$slice$postfix\n${" " * markOffset}^\n";
99 ^\n";
100 } 93 }
101 } 94 }
102 class IntegerDivisionByZeroException implements Exception {const IntegerDivisio nByZeroException(); 95 class IntegerDivisionByZeroException implements Exception {const IntegerDivisio nByZeroException();
103 String toString() => "IntegerDivisionByZeroException"; 96 String toString() => "IntegerDivisionByZeroException";
104 } 97 }
OLDNEW
« no previous file with comments | « test/dart_codegen/expect/core/errors.dart ('k') | test/dart_codegen/expect/core/list.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698