js-code-to-svg-flowchart icon indicating copy to clipboard operation
js-code-to-svg-flowchart copied to clipboard

es8 async/await bug

Open yanhaijing opened this issue 7 years ago • 6 comments

es5 code is work

image

es6 code don't work

image

yanhaijing avatar Sep 19 '18 09:09 yanhaijing

@yanhaijing hey. Thanks for feedback. Not sure what is logic behind that code, but valid code will be

var a = 12;
if (a) {
  const a = 1;
} else {
  const a = 2;
}

so const is block scoped but var not. And that code works fine.

Bogdan-Lyashenko avatar Sep 19 '18 11:09 Bogdan-Lyashenko

thank you advice, but I want use the tool to process my work code, my work code is written by es6, o(╥﹏╥)o

yanhaijing avatar Sep 19 '18 11:09 yanhaijing

@yanhaijing that's fine, it does support es6. You can check examples https://github.com/Bogdan-Lyashenko/js-code-to-svg-flowchart/tree/master/docs/examples (code-sample.js), each of them written in es6.

Bogdan-Lyashenko avatar Sep 19 '18 11:09 Bogdan-Lyashenko

https://bogdan-lyashenko.github.io/js-code-to-svg-flowchart/docs/live-editor/index.html

↑this url enter code ↓, async don't support

async function () {
	
}

yanhaijing avatar Sep 19 '18 11:09 yanhaijing

ah, I see, yes, it's not supported, sorry for that. async-await are es7 features, not es6 😛 I need to update babylon AST parser to support that.

Bogdan-Lyashenko avatar Sep 19 '18 11:09 Bogdan-Lyashenko

Thank you for your work. Come on

yanhaijing avatar Sep 19 '18 12:09 yanhaijing