robertkrimen / otto

A JavaScript interpreter in Go (golang)
http://godoc.org/github.com/robertkrimen/otto
MIT License
8.01k stars 584 forks source link

Code generator: AST ⇒ javascript code #512

Open deoxykev opened 9 months ago

deoxykev commented 9 months ago

Is there a way to translate an *ast.Program back into valid javascript source code, like babel/generator?

My use case would be modifying javascript on-the-fly in a proxy.

If not, is it on the roadmap?

stevenh commented 9 months ago

That functionality doesn't exist I'm afraid and seems like quite a uncommon need, so likely out of scope for this.

deoxykev commented 9 months ago

Would you accept a PR if I took a crack at it?

Sent from Proton Mail for iOS

On Fri, Dec 8, 2023 at 4:33 PM, Steven Hartland @.***(mailto:On Fri, Dec 8, 2023 at 4:33 PM, Steven Hartland < wrote:

That functionality doesn't exist I'm afraid and seems like quite a uncommon need, so likely out of scope for this.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

stevenh commented 9 months ago

Absolutely