diff options
Diffstat (limited to 'lib/parse.js')
-rw-r--r-- | lib/parse.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/parse.js b/lib/parse.js index 5a4d9811..ef88e72c 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -1504,14 +1504,14 @@ function parse($TEXT, options) { } function export_default_decl() { - switch (S.token.value) { - case "async": + if (is("name", "async")) { if (!is_token(peek(), "keyword", "function")) return; next(); next(); if (!is("operator", "*")) return maybe_named(AST_AsyncDefun, function_(AST_AsyncFunction)); next(); return maybe_named(AST_AsyncGeneratorDefun, function_(AST_AsyncGeneratorFunction)); + } else if (is("keyword")) switch (S.token.value) { case "class": next(); return maybe_named(AST_DefClass, class_(AST_ClassExpression)); @@ -1524,13 +1524,13 @@ function parse($TEXT, options) { } var export_decl = embed_tokens(function() { - switch (S.token.value) { - case "async": + if (is("name", "async")) { next(); expect_token("keyword", "function"); if (!is("operator", "*")) return function_(AST_AsyncDefun); next(); return function_(AST_AsyncGeneratorDefun); + } else if (is("keyword")) switch (S.token.value) { case "class": next(); return class_(AST_DefClass); |