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

Unified Diff: lib/compiler/implementation/lib/js_helper.dart

Issue 10914116: Remove errors.dart in dart2js compiler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « lib/compiler/implementation/lib/errors.dart ('k') | lib/core/errors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/lib/js_helper.dart
diff --git a/lib/compiler/implementation/lib/js_helper.dart b/lib/compiler/implementation/lib/js_helper.dart
index 39f277aba8053a1f75637522466aba4c337e1fd9..683929aa218674aa657813331af055b9885bbc21 100644
--- a/lib/compiler/implementation/lib/js_helper.dart
+++ b/lib/compiler/implementation/lib/js_helper.dart
@@ -811,7 +811,7 @@ unwrapException(ex) {
// Examples:
// x.foo is not a function
// 'undefined' is not a function (evaluating 'x.foo(1,2,3)')
- // Object doesn't support property or method 'foo' which sets the error
+ // Object doesn't support property or method 'foo' which sets the error
// code 438 in IE.
// TODO(kasperl): Compute the right name if possible.
return new NoSuchMethodException('', '<unknown>', []);
@@ -947,6 +947,9 @@ interface Dynamic {
/**
* Represents the type of Null. The compiler treats this specially.
+ * TODO(lrn): Null should be defined in core. It's a class, like int.
+ * It just happens to act differently in assignability tests and,
+ * like int, can't be extended or implemented.
*/
class Null {
factory Null() {
@@ -1187,6 +1190,37 @@ listSuperNativeTypeCast(value, property) {
interface JavaScriptIndexingBehavior {
}
+// TODO(lrn): These exceptions should be implemented in core.
+// When they are, remove the 'Implementation' here.
+
+/** Thrown by type assertions that fail. */
+class TypeErrorImplementation implements TypeError {
+ final String msg;
+ const TypeErrorImplementation(String this.msg);
+ String toString() => msg;
+}
+
+/** Thrown by the 'as' operator if the cast isn't valid. */
+class CastExceptionImplementation implements CastException {
+ // TODO(lrn): Rename to CastError (and move implementation into core).
+ // TODO(lrn): Change actualType and expectedType to "Type" when reified
+ // types are available.
+ final Object actualType;
+ final Object expectedType;
+
+ CastExceptionImplementation(this.actualType, this.expectedType);
+
+ String toString() {
+ return "CastException: Casting value of type $actualType to"
+ " incompatible type $expectedType";
+ }
+}
+
+class FallThroughErrorImplementation implements FallThroughError {
+ const FallThroughErrorImplementation();
+ String toString() => "Switch case fall-through.";
+}
+
/**
* Called by generated code when a method that must be statically
* resolved cannot be found.
« no previous file with comments | « lib/compiler/implementation/lib/errors.dart ('k') | lib/core/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698