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

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

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
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 10 matching lines...) Expand all
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 = ((__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 = ((__x4) => DDC$RT.cast(__x4, dynamic, String, "CastGeneral", """ line 113, column 23 of dart:core/exceptions.dart: """, __x4 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;
41 i < offset; 41 i < offset;
42 i++) { 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)); 43 int char = ((__x5) => DDC$RT.cast(__x5, dynamic, int, "CastGeneral", """line 123 , column 18 of dart:core/exceptions.dart: """, __x5 is int, true))(source.codeUn itAt(i));
44 if (char == 0x0a) { 44 if (char == 0x0a) {
45 if (lineStart != i || !lastWasCR) { 45 if (lineStart != i || !lastWasCR) {
46 lineNum++; 46 lineNum++;
47 } 47 }
48 lineStart = i + 1; 48 lineStart = i + 1;
49 lastWasCR = false; 49 lastWasCR = false;
50 } 50 }
51 else if (char == 0x0d) { 51 else if (char == 0x0d) {
52 lineNum++; 52 lineNum++;
53 lineStart = i + 1; 53 lineStart = i + 1;
54 lastWasCR = true; 54 lastWasCR = true;
55 } 55 }
56 } 56 }
57 if (lineNum > 1) { 57 if (lineNum > 1) {
58 report += " (at line $lineNum, character ${offset - lineStart + 1} 58 report += " (at line $lineNum, character ${offset - lineStart + 1}
59 )\n"; 59 )\n";
60 } 60 }
61 else { 61 else {
62 report += " (at character ${offset + 1} 62 report += " (at character ${offset + 1}
63 )\n"; 63 )\n";
64 } 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); 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; 66 for (int i = offset;
67 i < source.length; 67 i < source.length;
68 i++) { 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)); 69 int char = ((__x6) => DDC$RT.cast(__x6, dynamic, int, "CastGeneral", """line 143 , column 18 of dart:core/exceptions.dart: """, __x6 is int, true))(source.codeUn itAt(i));
70 if (char == 0x0a || char == 0x0d) { 70 if (char == 0x0a || char == 0x0d) {
71 lineEnd = i; 71 lineEnd = i;
72 break; 72 break;
73 } 73 }
74 } 74 }
75 int length = lineEnd - lineStart; 75 int length = lineEnd - lineStart;
76 int start = lineStart; 76 int start = lineStart;
77 int end = lineEnd; 77 int end = lineEnd;
78 String prefix = ""; 78 String prefix = "";
79 String postfix = ""; 79 String postfix = "";
80 if (length > 78) { 80 if (length > 78) {
81 int index = offset - lineStart; 81 int index = offset - lineStart;
82 if (index < 75) { 82 if (index < 75) {
83 end = start + 75; 83 end = start + 75;
84 postfix = "..."; 84 postfix = "...";
85 } 85 }
86 else if (end - offset < 75) { 86 else if (end - offset < 75) {
87 start = end - 75; 87 start = end - 75;
88 prefix = "..."; 88 prefix = "...";
89 } 89 }
90 else { 90 else {
91 start = offset - 36; 91 start = offset - 36;
92 end = offset + 36; 92 end = offset + 36;
93 prefix = postfix = "..."; 93 prefix = postfix = "...";
94 } 94 }
95 } 95 }
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)); 96 String slice = ((__x7) => DDC$RT.cast(__x7, dynamic, String, "CastGeneral", """ line 171, column 20 of dart:core/exceptions.dart: """, __x7 is String, true))(so urce.substring(start, end));
97 int markOffset = offset - start + prefix.length; 97 int markOffset = offset - start + prefix.length;
98 return "$report$prefix$slice$postfix\n${" " * markOffset} 98 return "$report$prefix$slice$postfix\n${" " * markOffset}
99 ^\n"; 99 ^\n";
100 } 100 }
101 } 101 }
102 class IntegerDivisionByZeroException implements Exception {const IntegerDivisio nByZeroException(); 102 class IntegerDivisionByZeroException implements Exception {const IntegerDivisio nByZeroException();
103 String toString() => "IntegerDivisionByZeroException"; 103 String toString() => "IntegerDivisionByZeroException";
104 } 104 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698