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

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

Issue 10915083: Change assert implementation to not depend on a top-level function called 'assert'. (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
Index: lib/compiler/implementation/lib/core_patch.dart
diff --git a/lib/compiler/implementation/lib/core_patch.dart b/lib/compiler/implementation/lib/core_patch.dart
index aea4c6c7c2e0df68062931c651de31cddc668398..bc3e3595f1859c9776e67caf5da1d5b84eb042c6 100644
--- a/lib/compiler/implementation/lib/core_patch.dart
+++ b/lib/compiler/implementation/lib/core_patch.dart
@@ -14,3 +14,11 @@ patch class Object {
throw new NoSuchMethodException(this, name, args);
}
}
+
+/**
+ * Helper function for implementing asserts. The compiler treats this specially.
ngeoffray 2012/09/05 10:37:10 Should that be in js_helper then? I don't think it
Lasse Reichstein Nielsen 2012/09/05 12:51:20 That would make sense. Will move it.
+ */
+void _assert(condition) {
+ if (condition is Function) condition = condition();
+ if (!condition) throw new AssertionError();
+}

Powered by Google App Engine
This is Rietveld 408576698