function* foo() {
  var { bar } = { bar: "bar" };
  return bar;
}

assert.equal(foo().next().value, "bar");

function* foo2({ bar = 0 }) {
  return bar;
}

assert.equal(foo2({ bar: undefined }).next().value, 0);
assert.equal(foo2({ bar: 3 }).next().value, 3);

function* foo3() {
  loop:
    while(true) {
      // Changing "let" to "var" makes the tests pass.
      let { what, value } = yield "iteration";

      switch(what) {
        case "one":
          // Removing these 5 lines makes the tests pass.
          if(value === 1) {
            break;
          } else if(value === 2) {
            break;
          }

        case "two":
          // Removing these 3 lines makes the tests pass.
          ["a", "b"].map(function(v) {
            return value + v;
          });

          break;

        case "three":
          break loop;
      }
    }
}

var gen3 = foo3();

assert.equal(gen3.next().value, "iteration");
assert.equal(gen3.next({what: "one", value: 3}).done, false);
assert.equal(gen3.next({what: "one", value: 2}).done, false);
assert.equal(gen3.next({what: "one", value: 1}).done, false);
assert.equal(gen3.next({what: "two", value: "sometext"}).done, false);
assert.equal(gen3.next({what: "three"}).done, true);

@@ -538,32 +538,37 @@
            break
+ loop
 ;%0A          %7D el
@@ -605,16 +605,21 @@
    break
+ loop
 ;%0A      
@@ -624,16 +624,32 @@
       %7D%0A
+          break;
 %0A       
@@ -803,16 +803,38 @@
    %7D);%0A%0A
+          break loop;%0A
         
@@ -842,17 +842,16 @@
  break;%0A
-%0A
         
@@ -882,24 +882,41 @@
 break loop;%0A
+          break;%0A
       %7D%0A    
@@ -1094,37 +1094,56 @@
 alue: 2%7D).done, 
-false
+true);%0A%0Avar gen4 = foo3(
 );%0Aassert.equal(
@@ -1149,51 +1149,35 @@
 (gen
-3
+4
 .next(
-%7Bwhat: %22one%22, value: 1%7D).done, false
+).value, %22iteration%22
 );%0Aa
@@ -1183,33 +1183,33 @@
 assert.equal(gen
-3
+4
 .next(%7Bwhat: %22tw
@@ -1230,37 +1230,102 @@
 metext%22%7D).done, 
-false
+true);%0A%0Avar gen5 = foo3();%0Aassert.equal(gen5.next().value, %22iteration%22
 );%0Aassert.equal(
@@ -1319,33 +1319,33 @@
 assert.equal(gen
-3
+5
 .next(%7Bwhat: %22th

Update regenerator test relying on wrong semantics Broken by fix to switch statements in block scoping