Skip to content

v1.2.0

Latest

Choose a tag to compare

@leafo leafo released this 12 Aug 14:47
· 4 commits to master since this release
v1.2.0

First release with language changes that add syntax on top of CoffeeScript 1.12.7.

  • Add const, which declares a block scoped JS const at the statement site instead of a hoisted var, with the name still reserved for the whole function at compile time so it can't be redeclared, shadowed, or reassigned
  • Compile const destructuring to native JS destructuring instead of the expanded ES5 form, so defaults apply only to undefined and array patterns use the iterator protocol, matching CoffeeScript 2
  • Report compile errors for reassigning a const (including +=, ++, loop variables, and writes from nested functions), redeclaring a name, using const as an expression, and patterns JS destructuring can't express
  • Add await, following the CoffeeScript 2 design: there is no async keyword, a function whose body contains await compiles to async function
  • Support await in bound functions, in comprehensions used as expressions (wrapped in an async IIFE), and as await return
  • Report compile errors for await outside a function, a function mixing yield and await, and await in a class constructor
  • await is now a keyword, so it can no longer be used as a variable name the way it could in CoffeeScript 1.x, property access is emitted as a["await"] like other keywords

Code that uses none of the new syntax still compiles byte-for-byte identical to CoffeeScript 1.12.7.

Full Changelog: v1.1.0...v1.2.0