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

Unified Diff: runtime/lib/null_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
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/core_patch.dart » ('j') | sdk/lib/core/errors.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/null_patch.dart
diff --git a/runtime/lib/null_patch.dart b/runtime/lib/null_patch.dart
index 312804e6b84c9dbb8e47654d25fc6f2ccbf62dd3..b3b9f76f4358fa60d4099d4b0b831374ba2aca65 100644
--- a/runtime/lib/null_patch.dart
+++ b/runtime/lib/null_patch.dart
@@ -14,5 +14,12 @@
int get hashCode => _HASH_CODE;
int get _identityHashCode => _HASH_CODE;
+ @patch noSuchMethod(Invocation invocation) {
+ String name = internal.Symbol.getName(invocation.memberName);
+ if (invocation.isMethod)
+ throw new NullDereferenceError('$name() was called on a null value.');
rmacnak 2016/10/10 21:29:38 DBC: "a null value" => "null" There is only one.
+ throw new NullDereferenceError('$name was accessed on a null value.');
+ }
+
String toString() => 'null';
}
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/core_patch.dart » ('j') | sdk/lib/core/errors.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698