shift-js / shift-js

Swift to JavaScript transpiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid Swift code is accepted and produces invalid Javascript on shiftjs.com REPL

MikeMayer opened this issue · comments

Invalid swift statements:

var a = 3print("\(++a++)")
var a = 3;
print("\(++a++)")

Produce

var a = 3;
console.log(++ + a++ + '');

Which is also invalid Javascript. I was happy to see string interpolation worked so naturally I had to try and break it.

It's not yet doing any syntactical checks on the input. Given the state of Swift, assumption is that most devs might use Xcode for all error checking, then transpile with the CLI. Still far from being ready for production. Thus, our code assumes valid Swift code is inputted, but we appreciate your finding and will see if we can add the ability to reject invalid swift code in our project as a future goal.

Thanks Mike. I'm going to close this since it is covered by Issue 275