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

Unified Diff: pkg/dev_compiler/tool/input_sdk/private/js_helper.dart

Issue 2979613002: Treat JS TypeError as Dart NSM (Closed)
Patch Set: Created 3 years, 5 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 | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
index 0017ebc9b16877df510e6ab71c831789f1b79945..8d960821848766431dad86d3aa34467b98ad930c 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -576,16 +576,16 @@ throwConcurrentModificationError(collection) {
throw new ConcurrentModificationError(collection);
}
-class NullError extends Error implements NoSuchMethodError {
- final String _message;
- final String _method;
-
- NullError(this._message, match)
- : _method = match == null ? null : JS('', '#.method', match);
+@JsPeerInterface(name: 'TypeError')
+class NullError extends Interceptor implements NoSuchMethodError {
+ StackTrace get stackTrace => Primitives.extractStackTrace(this);
String toString() {
- if (_method == null) return 'NullError: $_message';
- return "NullError: method not found: '$_method' on null";
+ // TODO(vsm): Distinguish between null reference errors and other
+ // TypeErrors. We should not get non-null TypeErrors from DDC code,
+ // but we may from native JavaScript.
+ var message = JS('String', '#.message', this);
+ return "NullError: $message";
}
}
« no previous file with comments | « pkg/dev_compiler/test/browser/language_tests.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698