Skip to content

Commit

Permalink
allow chaining methods into import.meta. Closes #1358
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiosantoscode committed Mar 21, 2023
1 parent 21600d9 commit e1d7b80
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/parse.js
Expand Up @@ -2308,7 +2308,7 @@ function parse($TEXT, options) {
return new_(allow_calls);
}
if (is("name", "import") && is_token(peek(), "punc", ".")) {
return import_meta();
return import_meta(allow_calls);
}
var start = S.token;
var peeked;
Expand Down Expand Up @@ -2801,15 +2801,15 @@ function parse($TEXT, options) {
});
}

function import_meta() {
function import_meta(allow_calls) {
var start = S.token;
expect_token("name", "import");
expect_token("punc", ".");
expect_token("name", "meta");
return subscripts(new AST_ImportMeta({
start: start,
end: prev()
}), false);
}), allow_calls);
}

function map_name(is_import) {
Expand Down
4 changes: 3 additions & 1 deletion test/compress/import-meta.js
Expand Up @@ -5,11 +5,13 @@ import_meta_basic: {
import.meta
import.meta.something
import.meta?.something
import.meta.url.includes()
}
expect: {
import.meta,
import.meta.something,
import.meta?.something
import.meta?.something,
import.meta.url.includes()
}
}

Expand Down

0 comments on commit e1d7b80

Please sign in to comment.