rzimmerman / kal

A powerful, easy-to-use, and easy-to-read programming language for the future.
http://rzimmerman.github.io/kal
MIT License
394 stars 18 forks source link

return statements compile to strange output #87

Closed rzimmerman closed 11 years ago

rzimmerman commented 11 years ago
function x()
  return 3

is compiling to something like

function x() {
  return null, 3;
}

Which technically works (and gets beautified out) but is really strange.

rzimmerman commented 11 years ago

Did a git bisect and found the cause:

61f2fedb27f08825231c9dbe31d4946e9ac637ad is the first bad commit
commit 61f2fedb27f08825231c9dbe31d4946e9ac637ad
Author: Rob Zimmerman <rmzimmerman@gmail.com>
Date:   Sun Jan 13 07:17:47 2013 +0000

    Rewrote wait for handlers, seems to be working with nested ifs
    No loop support yet

:040000 040000 c3be0cb2a819109cd09e864c9bbb213c3399aa44 71536cec26261f889e60a6b58b966f280e28e6e8 M  compiled
:040000 040000 1fe39e8d4f21ac1097b02b143f08a63653c5c6d4 32bf932b4aedb4101cbbeaf6fae0fc89774610f6 M  source
:040000 040000 54bc5c51ac456628e1242ba6052a7c10fe58d13a 5d837c57b22bb50fd2d0d606e141bc981636a4d3 M  tests

It looks like this bug has been here all along in 0.4.x.