support new.target (#4746)

fixes #4745
This commit is contained in:
Alex Lam S.L
2021-03-06 23:11:36 +00:00
committed by GitHub
parent ad903e9240
commit c7520b4b97
4 changed files with 55 additions and 1 deletions

View File

@@ -1736,6 +1736,15 @@ function parse($TEXT, options) {
var new_ = function(allow_calls) {
var start = S.token;
expect_token("operator", "new");
if (is("punc", ".") && is_token(peek(), "name", "target")) {
next();
next();
return new AST_NewTarget({
name: "new.target",
start: start,
end: prev(),
})
}
var newexp = expr_atom(false), args;
if (is("punc", "(")) {
next();