Skip to content

Releases: dk00/livescript-next

0.0.4

12 Mar 01:35

Choose a tag to compare

Implement Original LS Feature

  • Bare splat call(super) a ....
  • Singed modulo operator a %% b.
  • Named destructing with named top structure {a}: b = c.
  • Named destructing with names in deeply nested structure {a: {{b}: c}} = d.
  • Object literals and substructures with default values a{b, c=d}.

🐛 Bug Fix

  • Bit shift operators .<<. .>>. .>>>..
  • Convert forward function composing a >> b.
  • Slicing with chains a b .[c to].
  • Named destructing in function parameters, with default value.

💅 Improvement

  • Errors are reported with source location.
  • Add source locations for generated and transformed nodes.
  • Optimize literal property copying: a <<< {b, c: d} is compiled to [a.b, a.c] = [b, d], a.
  • Assignment result variables is reused when caching is required.
  • Partial applied operators are converted to arrow functions.
  • Function blocks are expanded before auto returning, to avoid additional do block at end of functions.
  • Literal property names are converted without computed flag.

0.0.3

27 Feb 00:38

Choose a tag to compare

Variable Scope

Variables are declared at beginning of function blocks, like original LS(instead of beginning of blocks).

Conversion of Existing Features

  • Named destructing {{x}: y} = z for assignments and function parameters.
  • List/Object comprehensions.
  • Function composing operator a . b << >>.
  • Unary do operator(do -> call function in place, without arguments).
  • of operator: convert to in
  • in operator: convert to a.includes b

Improvements

  • Bound function ~> is converted to arrow function =>.
  • Binary expressions with << ++ <? >? <<< are merged with same type.
  • Output of export \lib : name is changed from export { default as name } from "lib" to export name from "lib".

0.0.2

12 Feb 00:36

Choose a tag to compare

Async and Await

Calls to await are converted to await expressions, also implicitly make the containing function async.

-> await something
function named
  await func args
(async function () {
  return await something;
});

async function named() {
  return await func(args);
}

Conversion of Existing Features

  • new operator new A new A b, c
  • Object/Array slicing & substructuring a{b, c} a[b, c]
  • Binding property access a~b is converted to bind operator ::a.b
  • Partial application to operators (a +) (+ a)
  • Allow suppressing automatic returning !-> !function

Improvements

  • Conversion of cascade is moved to LS node transform, and no more uses additional cache variables for nested cascade
  • Conversion of switch statements are also moved to LS node transform, added source locations, should result better source maps and coverage support.

0.0.1

30 Jan 05:48

Choose a tag to compare

The convert function is self-hosting, it generates identical result with itself, and passes all test.

Implemented features:

  • import / export
  • Functions, return
  • Chain: property access, function call
  • JS operators
  • Assignment and destructuring*
  • if / else statement
  • Literals
  • Cascade ..
  • switch / case statement*
  • try / throw / catch / finally*

Things might be different:

  • Block scope: every variable are declare at beginning of block.
  • Result of statements are handled by do expressions, but the current babel implementation is buggy. try statements might not return result properly, and switch statements are converted to ?: expressions, so fallthrough is not supported at this time.