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

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/barback/cycle_exception.dart

Issue 657673002: Regenerate pub sources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/pub_generated/lib/src/barback/cycle_exception.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/barback/cycle_exception.dart b/sdk/lib/_internal/pub_generated/lib/src/barback/cycle_exception.dart
index b516cd7ea0912c33a996c9649080ec3ca2fbe3a8..8fdd04788b4df97719f2c15708fda8b6dd3951e9 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/barback/cycle_exception.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/barback/cycle_exception.dart
@@ -1,10 +1,33 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
library pub.barback.cycle_exception;
+
import '../exceptions.dart';
+
+/// An exception thrown when a transformer dependency cycle is detected.
+///
+/// A cycle exception is usually produced within a deeply-nested series of
+/// calls. The API is designed to make it easy for each of these calls to add to
+/// the message so that the full reasoning for the cycle is made visible to the
+/// user.
+///
+/// Each call's individual message is called a "step". A [CycleException] is
+/// represented internally as a linked list of steps.
class CycleException implements ApplicationException {
+ /// The step for this exception.
final String _step;
+
+ /// The next exception in the linked list.
+ ///
+ /// [_next]'s steps come after [_step].
final CycleException _next;
+
+ /// A list of all steps in the cycle.
List<String> get steps {
if (_step == null) return [];
+
var exception = this;
var steps = [];
while (exception != null) {
@@ -13,17 +36,25 @@ class CycleException implements ApplicationException {
}
return steps;
}
+
String get message {
var steps = this.steps;
if (steps.isEmpty) return "Transformer cycle detected.";
return "Transformer cycle detected:\n" +
steps.map((step) => " $step").join("\n");
}
- CycleException([this._step]) : _next = null;
+
+ /// Creates a new [CycleException] with zero or one steps.
+ CycleException([this._step])
+ : _next = null;
+
CycleException._(this._step, this._next);
+
+ /// Returns a copy of [this] with [step] added to the beginning of [steps].
CycleException prependStep(String step) {
if (_step == null) return new CycleException(step);
return new CycleException._(step, this);
}
+
String toString() => message;
}

Powered by Google App Engine
This is Rietveld 408576698