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

Unified Diff: sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart

Issue 14673004: Guard more thoroughly against stack overflows in the backtracking version solver. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change. Created 7 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 | « no previous file | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
diff --git a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
index a5e3e3c5b4ea4a8df3dc16dc121b7e7146601af5..73af43e78e533b4ac3bf042deb868f12972b5ffa 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart
@@ -168,7 +168,7 @@ class BacktrackingSolver {
/// version of it. If there are no more versions, continues to backtrack to
/// previous selections, and so on. If there is nothing left to backtrack to,
/// completes to the last failure that occurred.
- Future<List<PackageId>> _traverseSolution() {
+ Future<List<PackageId>> _traverseSolution() => resetStack(() {
return new Traverser(this).traverse().catchError((error) {
if (error is! SolveFailure) throw error;
@@ -180,7 +180,7 @@ class BacktrackingSolver {
// All out of solutions, so fail.
throw error;
});
- }
+ });
/// Backtracks from the current failed solution and determines the next
/// solution to try. If possible, it will backjump based on the cause of the
@@ -408,9 +408,7 @@ class Traverser {
// Move onto the next package if we've traversed all of these references.
if (refs.isEmpty) return _traversePackage();
- // Pump the event loop to flatten the stack trace and workaround #9583.
- // If that bug is fixed, this can be Future.sync() instead.
- return new Future(() {
+ return resetStack(() {
var ref = refs.removeFirst();
_validateDependency(ref, depender);
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698