MVCoconut / coconut.ui

Wow, such reactive view! Much awesome!
The Unlicense
89 stars 9 forks source link

Parsing problem #3

Closed kevinresol closed 7 years ago

kevinresol commented 7 years ago

I think this one is about tink_hxx, but I am not sure

import coconut.Ui.*;
import coconut.ui.*;
import coconut.data.*;

class Main {
    static function main() {
        hxx('<Dropdown values=${List.fromArray([{name:'a'}, {name:'b'}])} />');
    }
}

class Dropdown extends View<{values:List<Value>}> {
    function render() '<div/>';
}

typedef Value = {
    var name(default, never):String;
}

Error: /Users/kevin/Codes/test/src/Main.hx:9: characters 67-68 : Unexpected b

If main() is

static function main() {
    var list = List.fromArray([{name:'a'}, {name:'b'}]);
    hxx('<Dropdown values=${List.fromArray([{name:'a'}, {name:'b'}])} />');
}

Error becomes:

/Users/kevin/Codes/test/src/Main.hx:9: characters 67-68 : Unexpected b
/Users/kevin/Codes/test/src/Main.hx:9: characters 67-68 : Missing ;
/Users/kevin/Codes/test/src/Main.hx:9: characters 68-77 : Missing ;
/Users/kevin/Codes/test/src/Main.hx:9: characters 77-78 : Unexpected )

It compiles if the List is stored in a variable before hxx();

back2dos commented 7 years ago

It's the Haxe parser in this case: https://github.com/HaxeFoundation/haxe/issues/6369

Try using double quotes in expressions for the time being ;)