From 3559afc1cde86a8a667c2ddef8800e88a664139e Mon Sep 17 00:00:00 2001
From: Natalie Weizenbaum <nweiz@google.com>
Date: Thu, 26 May 2016 12:54:44 -0700
Subject: [PATCH] dependencyIntoDisallowed

---
 lib/src/solver/deducer.dart | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/lib/src/solver/deducer.dart b/lib/src/solver/deducer.dart
index 6de019c6..6db0cfc7 100644
--- a/lib/src/solver/deducer.dart
+++ b/lib/src/solver/deducer.dart
@@ -76,6 +76,9 @@ class Deducer {
         fact = _dependencyIntoReqired(fact);
         if (fact == null) continue;
 
+        fact = _dependencyIntoDisallowed(fact);
+        if (fact == null) continue;
+
         _dependenciesByDepender
             .putIfAbsent(fact.depender.toRef(), () => new Set())
             .add(fact);
@@ -593,6 +596,24 @@ class Deducer {
     return null;
   }
 
+  Dependency _dependencyIntoDisallowed(Dependency fact) {
+    // Trim [fact] if some of its depender is disallowed.
+    var disallowed = _disallowed[fact.depender.toRef()];
+    if (disallowed != null) fact = _disallowedAndDepender(disallowed, fact);
+    if (fact == null) return null;
+
+    // Trim [fact] if some of its allowed versions are disallowed.
+    disallowed = _disallowed[fact.allowed.toRef()];
+    if (disallowed == null) return fact;
+    var result = _disallowedAndAllowed(disallowed, fact);
+    if (result is Dependency) return result;
+
+    // Add to [_toProcess] because [_fromCurrent] will get discarded when we
+    // return `null`.
+    _toProcess.add(result);
+    return null;
+  }
+
   // Resolves [required] and [disallowed], which should refer to the same
   // package.
   //
-- 
GitLab