Bogdan-Lyashenko / js-code-to-svg-flowchart

js2flowchart - a visualization library to convert any JavaScript code into beautiful SVG flowchart. Learn other’s code. Design your code. Refactor code. Document code. Explain code.
MIT License
7.04k stars 471 forks source link

es8 async/await bug #30

Open yanhaijing opened 5 years ago

yanhaijing commented 5 years ago

es5 code is work

image

es6 code don't work

image

Bogdan-Lyashenko commented 5 years ago

@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.

yanhaijing commented 5 years ago

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

Bogdan-Lyashenko commented 5 years ago

@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.

yanhaijing commented 5 years ago

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 () {

}
Bogdan-Lyashenko commented 5 years ago

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.

yanhaijing commented 5 years ago

Thank you for your work. Come on