Skip to content

Commit

Permalink
Added support for exported field of ExportAllDeclaration
Browse files Browse the repository at this point in the history
  • Loading branch information
sanex3339 committed Aug 14, 2020
1 parent ab53cd5 commit e8a4c6a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 6 deletions.
15 changes: 12 additions & 3 deletions escodegen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1275,14 +1275,23 @@

ExportAllDeclaration: function (stmt, flags) {
// export * FromClause ;
return [
var result = [
'export' + space,
'*' + space,
'*' + space
];

if (stmt.exported) {
result.push('as ' + stmt.exported.name + ' ');
}

result = join(result, [
'from' + space,
// ModuleSpecifier
this.generateExpression(stmt.source, Precedence.Sequence, E_TTT),
this.semicolon(flags)
];
]);

return result;
},

ExpressionStatement: function (stmt, flags) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"source-map": "~0.6.1"
},
"devDependencies": {
"acorn": "^7.3.1",
"acorn": "^8.0.1",
"bluebird": "^3.4.7",
"bower-registry-client": "^1.0.0",
"chai": "^4.2.0",
Expand Down
6 changes: 4 additions & 2 deletions test/compare-acorn-es2020.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ function test(code, expected) {
options = {
ranges: false,
locations: false,
ecmaVersion: 11
ecmaVersion: 11,
sourceType: 'module'
};

tree = acorn.parse(code, options);
Expand All @@ -58,7 +59,8 @@ function testMin(code, expected) {
options = {
ranges: false,
locations: false,
ecmaVersion: 11
ecmaVersion: 11,
sourceType: 'module'
};

tree = acorn.parse(code, options);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as name from 'OK';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export*as name from'OK'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * as name from 'OK';

0 comments on commit e8a4c6a

Please sign in to comment.