Skip to content

Instantly share code, notes, and snippets.

@clemmy
Last active December 14, 2017 23:43
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save clemmy/ba676e384a050790b94f99698033306c to your computer and use it in GitHub Desktop.
*{{ a: 1 }} // { a: 1 }
*{
  ({ a: 1 })
} // { a: 1 }
*{ { a: 1 } 5; } // 5
*{
  let x = 5;
  { a: 1 }
} // 5
*{
  for (var i=0; i<2; ++i) i;
} // 1
*{
  a:
  while (true) {
    break a;
  }
  5;
} // 5
*{
  var a = true;
  if (a) 1;
  else 2;
} // 1
*{
  var a = true;
  if (a) yield 1;
  else yield 2;
} // [1]
*{
  yield null;
} // [null]
*{
  const identity = (i) => { return i; }
  for (var i=0; i<5; ++i) {
    yield identity(i);
  }
} // [0, 1, 2, 3, 4]
*{
  for (var i=0; i<5; ++i) {
    if (i === 2) continue;
    yield identity(i);
  }
} // [0, 1, 2, 3, 4]
*{
  a:
  for (var i=0; i<5; ++i) {
    for (var j=20; j<25; ++j) {
      if (j === 21) {
        continue a;
      }
      yield i + ' ' + j
    }
  } // [0 20, 1 20, 2 20,  3 20, 4 20]
}
*{
  break;
} // error
*{
  return;
} // error
*{
  continue;
} // error
<div *{...{a:1}} /> // error
*{
  () => 1
} // () => 1
*{
  function *() { 1; }
} // function* () { 1; }
*{
  class foo {}
} // class foo {}
*{[1]} // [1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment