support class static initialization block (#5488)

This commit is contained in:
Alex Lam S.L
2022-06-06 05:01:15 +01:00
committed by GitHub
parent d2bd0d1c1c
commit 88b4283200
6 changed files with 304 additions and 31 deletions

View File

@@ -1119,6 +1119,18 @@ function parse($TEXT, options) {
}));
continue;
}
if (fixed && is("punc", "{")) {
props.push(new AST_ClassInit({
start: start,
value: new AST_ClassInitBlock({
start: start,
body: block_(),
end: prev(),
}),
end: prev(),
}));
continue;
}
var internal = is("name") && /^#/.test(S.token.value);
var key = as_property_key();
if (is("punc", "(")) {