dep.js: Set up `BAD' correctly.
[dep-ui] / dep.js
diff --git a/dep.js b/dep.js
index f4b0ff9..d5235be 100644 (file)
--- a/dep.js
+++ b/dep.js
@@ -18,7 +18,7 @@
  * GNU Library General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ * along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
 var DEP = { }; (function () {
@@ -118,7 +118,7 @@ var F_CHANGED = 4;                  // Changed in current phase.
 var F_RECOMPUTING = 8;                 // Currently being recomputed.
 var F_QUEUED = 16;                     // Queued for recomputation.
 
-var BAD = Tag('BAD')                   // Used for the value of `bad' deps.
+var BAD = new Tag('BAD');              // Used for the value of `bad' deps.
 
 var DELAYED = [];                      // Actions delayed by `with_frozen'.
 var PENDING = [];                      // Deps awaiting recomputation.
@@ -178,7 +178,7 @@ function Dep(value, maybefunc) {
     func = value;
     f |= F_QUEUED;
   } else {
-    val = value;
+    val = value === undefined ? BAD : value;
     func = null;
     f |= F_VALUE | F_DEPS;
   }
@@ -497,10 +497,9 @@ function with_frozen(body, delay) {
    * If the BODY function changes any dep values (using D.set_value(...))
    * then dependents won't be updated until the BODY completes.
    *
-   * It's very
-   * bad to do this during a recomputation phase.  If DELAY is true, then the
-   * BODY is delayed until the recomputation completes; otherwise you get an
-   * exception.
+   * It's very bad to do this during a recomputation phase.  If DELAY is
+   * true, then the BODY is delayed until the recomputation completes;
+   * otherwise you get an exception.
    */
 
   var op, val;