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

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

Issue 1137543005: Type check binary expressions (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase and remove assert Created 5 years, 7 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 }
11 class FormatException implements Exception {final String message; 11 class FormatException implements Exception {final String message;
12 final source; 12 final source;
13 final int offset; 13 final int offset;
14 const FormatException([this.message = "", this.source, this.offset = -1]); 14 const FormatException([this.message = "", this.source, this.offset = -1]);
15 String toString() { 15 String toString() {
16 String report = "FormatException"; 16 String report = "FormatException";
17 if (message != null && "" != message) { 17 if (message != null && "" != message) {
18 report = "$report: $message"; 18 report = "$report: $message";
19 } 19 }
20 int offset = this.offset; 20 int offset = this.offset;
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 > 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; 28 offset = -1;
29 } 29 }
30 if (offset == -1) { 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); 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) { 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;
(...skipping 14 matching lines...) Expand all
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, "DynamicCast", """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 < 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)); 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) { 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 = "";
(...skipping 15 matching lines...) Expand all
88 } 88 }
89 } 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)); 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; 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 }
OLDNEW
« lib/runtime/dart/_interceptors.js ('K') | « test/codegen/fieldtest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698