Chromium Code Reviews| Index: frog/lib/corelib.dart |
| diff --git a/frog/lib/corelib.dart b/frog/lib/corelib.dart |
| index e96946b57880220683b55d7eca185a14cae42c8a..8e784c7a285d75b8524dda12a9db78ff78347c83 100644 |
| --- a/frog/lib/corelib.dart |
| +++ b/frog/lib/corelib.dart |
| @@ -68,11 +68,14 @@ void print(Object obj) native '''if (typeof console == 'object') { |
| class AssertError { |
| final String failedAssertion; |
| + |
| + // TODO(jmesserly): I don't think these should be here. They are properties of |
| + // the stack trace |
| final String url; |
| final int line; |
| final int column; |
| - AssertError(this.failedAssertion, this.url, this.line, this.column); |
| + AssertError._internal(this.failedAssertion, this.url, this.line, this.column); |
| String toString() { |
| return "Failed assertion: '$failedAssertion' is not true " + |
| @@ -80,25 +83,26 @@ class AssertError { |
| } |
| } |
| -class TypeError extends AssertError { |
| +// TODO(jmesserly): fix the strange interaction with JS TypeError, such as |
| +// toString(). Ideally this would generate to a different JS name but I'm not |
| +// sure how to force that. |
| +class TypeError extends AssertError native 'TypeError' { |
| final String srcType; |
| final String dstType; |
| - TypeError(this.srcType, this.dstType) : super(null, null, null, null); |
| - |
| - String toString() { |
| - return "Failed type check: type $srcType is not assignable to type " + |
| - "$dstType"; |
| - } |
| + TypeError._internal(Object src, String dstType) native @''' |
| +this.srcType = (src == null ? "Null" : src.$typeNameOf()); |
| +this.destType = destType; |
|
sra1
2011/11/30 23:12:49
BUG: dstType vs destType.
You should add a test t
Jennifer Messerly
2011/12/01 00:38:07
Good catch! Hopefully we can make this entire meth
|
| +this.toString = function() { |
| + return ("Failed type check: type " + this.srcType + |
| + " is not assignable to type" + this.dstType); |
| +}'''; |
| } |
| class FallThroughError { |
| - |
| const FallThroughError(); |
| - String toString() { |
| - return "Switch case fall-through."; |
| - } |
| + String toString() => "Switch case fall-through."; |
| } |
| // Dart core library. |