asgerf / parsejs.dart

JavaScript parser for Dart
BSD 2-Clause "Simplified" License
26 stars 11 forks source link

JS 2 Dart #5

Closed MikeMitterer closed 7 years ago

MikeMitterer commented 7 years ago

Hi, have you tried to generate Dart code from AST?

asgerf commented 7 years ago

Partly. The dartify experiment generates a Dart API for a JS library based on its AST and a heap snapshot extracted with jsnap (note: dartify is not working, don't use it). Jsnap helps eliminate the nasty meta-programming that often happens during start-up of JS libraries (to build class hierarchies, etc).

But generating code for method bodies for actually porting JS code to Dart: nope. Even with jsnap there to help it's just too hard to get out anything useful.