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

Unified Diff: tool/input_sdk/lib/core/exceptions.dart

Issue 1952013002: Update core/{bool,errors,exceptions} (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tool/input_sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/input_sdk/lib/core/exceptions.dart
diff --git a/tool/input_sdk/lib/core/exceptions.dart b/tool/input_sdk/lib/core/exceptions.dart
index 6191e27c05aed3ad27f7ae775af8b7004ccf6112..7484ed567dedb603eeccc30741a25abb37bd94a1 100644
--- a/tool/input_sdk/lib/core/exceptions.dart
+++ b/tool/input_sdk/lib/core/exceptions.dart
@@ -18,15 +18,15 @@ part of dart.core;
* until the actual exceptions used by a library are done.
*/
abstract class Exception {
- factory Exception([var message]) => new _ExceptionImplementation(message);
+ factory Exception([var message]) => new _Exception(message);
}
/** Default implementation of [Exception] which carries a message. */
-class _ExceptionImplementation implements Exception {
+class _Exception implements Exception {
final message;
- _ExceptionImplementation([this.message]);
+ _Exception([this.message]);
String toString() {
if (message == null) return "Exception";
@@ -46,7 +46,7 @@ class FormatException implements Exception {
final String message;
/**
- * The actual source input that caused the error.
+ * The actual source input which caused the error.
*
* This is usually a [String], but can be other types too.
* If it is a string, parts of it may be included in the [toString] message.
@@ -73,10 +73,10 @@ class FormatException implements Exception {
/**
* Creates a new FormatException with an optional error [message].
*
- * Optionally also supply the actual [source] that had the incorrect format,
- * and an [offset] in the format where a problem was detected.
+ * Optionally also supply the actual [source] with the incorrect format,
+ * and the [offset] in the format where a problem was detected.
*/
- const FormatException([this.message = "", this.source, this.offset = -1]);
+ const FormatException([this.message = "", this.source, this.offset]);
/**
* Returns a description of the format exception.
@@ -100,16 +100,16 @@ class FormatException implements Exception {
}
int offset = this.offset;
if (source is! String) {
- if (offset != -1) {
+ if (offset != null) {
report += " (at offset $offset)";
}
return report;
}
- if (offset != -1 && (offset < 0 || offset > source.length)) {
- offset = -1;
+ if (offset != null && (offset < 0 || offset > source.length)) {
+ offset = null;
}
// Source is string and offset is null or valid.
- if (offset == -1) {
+ if (offset == null) {
String source = this.source;
if (source.length > 78) {
source = source.substring(0, 75) + "...";
@@ -174,6 +174,7 @@ class FormatException implements Exception {
}
}
+// Exception thrown when doing integer division with a zero divisor.
class IntegerDivisionByZeroException implements Exception {
const IntegerDivisionByZeroException();
String toString() => "IntegerDivisionByZeroException";
« no previous file with comments | « tool/input_sdk/lib/core/errors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698