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

Unified Diff: sdk/lib/_internal/js_runtime/lib/core_patch.dart

Issue 2407603002: Give useful message for null derefs (Closed)
Patch Set: Give useful message for null derefs Created 4 years, 2 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
Index: sdk/lib/_internal/js_runtime/lib/core_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 5d84791f113a18360f42f0b0c11f2bdc1b07c59f..8e4fdef830814f1e4501af428a3fd895371aaed0 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -65,6 +65,18 @@ class Object {
Type get runtimeType => getRuntimeType(this);
}
+// Patch for Null implementation
+@patch
+class Null {
+ @patch
+ dynamic noSuchMethod(Invocation invocation) {
+ String name = _symbolToString(invocation.memberName);
+ if (invocation.isMethod)
+ throw new NullDereferenceError('$name() was called on a null value.');
+ throw new NullDereferenceError('$name was accessed on a null value.');
+ }
+}
+
// Patch for Function implementation.
@patch
class Function {

Powered by Google App Engine
This is Rietveld 408576698