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

Unified Diff: third_party/pkg/di/lib/src/error_helper.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « third_party/pkg/di/lib/src/base_injector.dart ('k') | third_party/pkg/di/lib/src/errors.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/di/lib/src/error_helper.dart
diff --git a/third_party/pkg/di/lib/src/error_helper.dart b/third_party/pkg/di/lib/src/error_helper.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c6035882ee2784c14ef08241c554596f7e989ba8
--- /dev/null
+++ b/third_party/pkg/di/lib/src/error_helper.dart
@@ -0,0 +1,23 @@
+library di.error_helper;
+
+import 'package:di/di.dart';
+import 'package:di/src/base_injector.dart';
+
+String error(ResolutionContext resolving, message, [Key appendDependency]) {
+ if (appendDependency != null) {
+ resolving = new ResolutionContext(resolving.depth + 1, appendDependency, resolving);
+ }
+
+ String graph = resolvedTypes(resolving).reversed.join(' -> ');
+
+ return '$message (resolving $graph)';
+}
+
+List<Key> resolvedTypes(ResolutionContext resolving) {
+ List resolved = [];
+ while (resolving.depth != 0) {
+ resolved.add(resolving.key);
+ resolving = resolving.parent;
+ }
+ return resolved;
+}
« no previous file with comments | « third_party/pkg/di/lib/src/base_injector.dart ('k') | third_party/pkg/di/lib/src/errors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698