v-wasm icon indicating copy to clipboard operation
v-wasm copied to clipboard

Match keyword throws SyntaxError

Open rumkin opened this issue 4 years ago • 2 comments

The code:

number := 2
str := match number {
    1    { 'one' }
    2    { 'two' }
    else { 'many'}
}

println('Value is $str')

Output:

SyntaxError: Unexpected token ';'
    at Function (<anonymous>)
    at HTMLButtonElement.<anonymous> (https://v-wasm.now.sh/main.js:132:34)

rumkin avatar Sep 13 '20 15:09 rumkin

I think its not implemented yet.

Delta456 avatar Sep 13 '20 15:09 Delta456

Yeah, match is just not implemented in the JS backend yet, unfortunately, so using it can produce invalid JS.

match will actually produce an empty string, so the JS would look something like let str = ;, which explains the error you’re getting. Similar thing for #4.

So this is actually an issue with V itself, given that the backend is still WIP.

zamfofex avatar Sep 13 '20 17:09 zamfofex