davidbonnet / astring

🌳 Tiny and fast JavaScript code generator from an ESTree-compliant AST.

Home Page:https://david.bonnet.cc/astring/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

classes with computed property definitions not supported

znewsham opened this issue · comments

commented

Motivation

I want to be able to convert to strings ASTs including computed property definitions (specifically symbols)

Expected behavior

const s = Symbol('123')
class X {
static [s] = 1;
}

generate(acorn.parse(code)) should result in the same output as input, instead the output is:

Actual behavior

const s = Symbol('123')
class X {
static s = 1; // note the lack of []
}

Hi @znewsham, thanks for raising that bug.