| Index: test/dart_codegen/expect/core/exceptions.dart
|
| diff --git a/test/dart_codegen/expect/core/exceptions.dart b/test/dart_codegen/expect/core/exceptions.dart
|
| index 85e68214c73cd861fe7baa9b82731e181539eeb3..cc546ce98a61fca71767284d39076b311dd27e68 100644
|
| --- a/test/dart_codegen/expect/core/exceptions.dart
|
| +++ b/test/dart_codegen/expect/core/exceptions.dart
|
| @@ -1,109 +1,104 @@
|
| part of dart.core;
|
| -
|
| -abstract class Exception {
|
| - factory Exception([var message]) => new _ExceptionImplementation(message);
|
| -}
|
| -class _ExceptionImplementation implements Exception {
|
| - final message;
|
| - _ExceptionImplementation([this.message]);
|
| - String toString() {
|
| - if (message == null) return "Exception";
|
| - return "Exception: $message";
|
| + abstract class Exception {factory Exception([var message]) => new _ExceptionImplementation(message);
|
| +}
|
| + class _ExceptionImplementation implements Exception {final message;
|
| + _ExceptionImplementation([this.message]);
|
| + String toString() {
|
| +if (message == null) return "Exception";
|
| + return "Exception: $message";
|
| +}
|
| +}
|
| + class FormatException implements Exception {final String message;
|
| + final source;
|
| + final int offset;
|
| + const FormatException([this.message = "", this.source, this.offset = -1]);
|
| + String toString() {
|
| +String report = "FormatException";
|
| + if (message != null && "" != message) {
|
| +report = "$report: $message";
|
| +}
|
| + int offset = this.offset;
|
| + if (source is! String) {
|
| +if (offset != -1) {
|
| + report += " (at offset $offset)";
|
| }
|
| + return report;
|
| }
|
| -class FormatException implements Exception {
|
| - final String message;
|
| - final source;
|
| - final int offset;
|
| - const FormatException([this.message = "", this.source, this.offset = -1]);
|
| - String toString() {
|
| - String report = "FormatException";
|
| - if (message != null && "" != message) {
|
| - report = "$report: $message";
|
| - }
|
| - int offset = this.offset;
|
| - if (source is! String) {
|
| - if (offset != -1) {
|
| - report += " (at offset $offset)";
|
| - }
|
| - return report;
|
| - }
|
| - if (offset != -1 && (offset < 0 || offset > source.length)) {
|
| - offset = -1;
|
| - }
|
| - if (offset == -1) {
|
| - String source = ((__x17) => DDC$RT.cast(__x17, dynamic, String,
|
| - "CastGeneral",
|
| - """line 113, column 23 of dart:core/exceptions.dart: """,
|
| - __x17 is String, true))(this.source);
|
| - if (source.length > 78) {
|
| - source = source.substring(0, 75) + "...";
|
| - }
|
| - return "$report\n$source";
|
| - }
|
| - int lineNum = 1;
|
| - int lineStart = 0;
|
| - bool lastWasCR;
|
| - for (int i = 0; i < offset; i++) {
|
| - int char = ((__x18) => DDC$RT.cast(__x18, dynamic, int, "CastGeneral",
|
| - """line 123, column 18 of dart:core/exceptions.dart: """,
|
| - __x18 is int, true))(source.codeUnitAt(i));
|
| - if (char == 0x0a) {
|
| - if (lineStart != i || !lastWasCR) {
|
| - lineNum++;
|
| - }
|
| - lineStart = i + 1;
|
| - lastWasCR = false;
|
| - } else if (char == 0x0d) {
|
| - lineNum++;
|
| - lineStart = i + 1;
|
| - lastWasCR = true;
|
| - }
|
| - }
|
| - if (lineNum > 1) {
|
| - report += " (at line $lineNum, character ${offset - lineStart + 1})\n";
|
| - } else {
|
| - report += " (at character ${offset + 1})\n";
|
| - }
|
| - int lineEnd = DDC$RT.cast(source.length, dynamic, int, "CastGeneral",
|
| - """line 141, column 19 of dart:core/exceptions.dart: """,
|
| - source.length is int, true);
|
| - for (int i = offset; i < source.length; i++) {
|
| - int char = ((__x19) => DDC$RT.cast(__x19, dynamic, int, "CastGeneral",
|
| - """line 143, column 18 of dart:core/exceptions.dart: """,
|
| - __x19 is int, true))(source.codeUnitAt(i));
|
| - if (char == 0x0a || char == 0x0d) {
|
| - lineEnd = i;
|
| - break;
|
| - }
|
| - }
|
| - int length = lineEnd - lineStart;
|
| - int start = lineStart;
|
| - int end = lineEnd;
|
| - String prefix = "";
|
| - String postfix = "";
|
| - if (length > 78) {
|
| - int index = offset - lineStart;
|
| - if (index < 75) {
|
| - end = start + 75;
|
| - postfix = "...";
|
| - } else if (end - offset < 75) {
|
| - start = end - 75;
|
| - prefix = "...";
|
| - } else {
|
| - start = offset - 36;
|
| - end = offset + 36;
|
| - prefix = postfix = "...";
|
| - }
|
| + if (offset != -1 && (offset < 0 || offset > source.length)) {
|
| +offset = -1;
|
| +}
|
| + if (offset == -1) {
|
| +String source = ((__x17) => DDC$RT.cast(__x17, dynamic, String, "CastGeneral", """line 113, column 23 of dart:core/exceptions.dart: """, __x17 is String, true))(this.source);
|
| + if (source.length > 78) {
|
| + source = source.substring(0, 75) + "...";
|
| + }
|
| + return "$report\n$source";
|
| +}
|
| + int lineNum = 1;
|
| + int lineStart = 0;
|
| + bool lastWasCR;
|
| + for (int i = 0;
|
| + i < offset;
|
| + i++) {
|
| +int char = ((__x18) => DDC$RT.cast(__x18, dynamic, int, "CastGeneral", """line 123, column 18 of dart:core/exceptions.dart: """, __x18 is int, true))(source.codeUnitAt(i));
|
| + if (char == 0x0a) {
|
| + if (lineStart != i || !lastWasCR) {
|
| + lineNum++;
|
| }
|
| - String slice = ((__x20) => DDC$RT.cast(__x20, dynamic, String,
|
| - "CastGeneral", """line 171, column 20 of dart:core/exceptions.dart: """,
|
| - __x20 is String, true))(source.substring(start, end));
|
| - int markOffset = offset - start + prefix.length;
|
| - return "$report$prefix$slice$postfix\n${" " * markOffset}^\n";
|
| + lineStart = i + 1;
|
| + lastWasCR = false;
|
| + }
|
| + else if (char == 0x0d) {
|
| + lineNum++;
|
| + lineStart = i + 1;
|
| + lastWasCR = true;
|
| }
|
| }
|
| -class IntegerDivisionByZeroException implements Exception {
|
| - const IntegerDivisionByZeroException();
|
| - String toString() => "IntegerDivisionByZeroException";
|
| + if (lineNum > 1) {
|
| +report += " (at line $lineNum, character ${offset - lineStart + 1}
|
| +)\n";
|
| +}
|
| + else {
|
| +report += " (at character ${offset + 1}
|
| +)\n";
|
| +}
|
| + int lineEnd = DDC$RT.cast(source.length, dynamic, int, "CastGeneral", """line 141, column 19 of dart:core/exceptions.dart: """, source.length is int, true);
|
| + for (int i = offset;
|
| + i < source.length;
|
| + i++) {
|
| +int char = ((__x19) => DDC$RT.cast(__x19, dynamic, int, "CastGeneral", """line 143, column 18 of dart:core/exceptions.dart: """, __x19 is int, true))(source.codeUnitAt(i));
|
| + if (char == 0x0a || char == 0x0d) {
|
| +lineEnd = i;
|
| + break;
|
| +}
|
| +}
|
| + int length = lineEnd - lineStart;
|
| + int start = lineStart;
|
| + int end = lineEnd;
|
| + String prefix = "";
|
| + String postfix = "";
|
| + if (length > 78) {
|
| +int index = offset - lineStart;
|
| + if (index < 75) {
|
| +end = start + 75;
|
| + postfix = "...";
|
| +}
|
| + else if (end - offset < 75) {
|
| +start = end - 75;
|
| + prefix = "...";
|
| +}
|
| + else {
|
| +start = offset - 36;
|
| + end = offset + 36;
|
| + prefix = postfix = "...";
|
| +}
|
| +}
|
| + String slice = ((__x20) => DDC$RT.cast(__x20, dynamic, String, "CastGeneral", """line 171, column 20 of dart:core/exceptions.dart: """, __x20 is String, true))(source.substring(start, end));
|
| + int markOffset = offset - start + prefix.length;
|
| + return "$report$prefix$slice$postfix\n${" " * markOffset}
|
| +^\n";
|
| +}
|
| +}
|
| + class IntegerDivisionByZeroException implements Exception {const IntegerDivisionByZeroException();
|
| + String toString() => "IntegerDivisionByZeroException";
|
| }
|
|
|