3434import com .semmle .js .ast .ExportDeclaration ;
3535import com .semmle .js .ast .ExportDefaultDeclaration ;
3636import com .semmle .js .ast .ExportNamedDeclaration ;
37+ import com .semmle .js .ast .ExportNamespaceSpecifier ;
3738import com .semmle .js .ast .ExportSpecifier ;
3839import com .semmle .js .ast .Expression ;
3940import com .semmle .js .ast .ExpressionStatement ;
@@ -507,6 +508,8 @@ private Node convertNodeUntyped(JsonObject node, String defaultKind) throws Pars
507508 return convertNamespaceDeclaration (node , loc );
508509 case "ModuleBlock" :
509510 return convertModuleBlock (node , loc );
511+ case "NamespaceExport" :
512+ return convertNamespaceExport (node , loc );
510513 case "NamespaceExportDeclaration" :
511514 return convertNamespaceExportDeclaration (node , loc );
512515 case "NamespaceImport" :
@@ -1170,11 +1173,11 @@ private Node convertExportAssignment(JsonObject node, SourceLocation loc) throws
11701173 private Node convertExportDeclaration (JsonObject node , SourceLocation loc ) throws ParseError {
11711174 Literal source = tryConvertChild (node , "moduleSpecifier" , Literal .class );
11721175 if (hasChild (node , "exportClause" )) {
1173- return new ExportNamedDeclaration (
1174- loc ,
1175- null ,
1176- convertChildren (node .get ("exportClause" ).getAsJsonObject (), "elements" ),
1177- source );
1176+ List < ExportSpecifier > specifiers =
1177+ hasKind ( node . get ( "exportClause" ), "NamespaceExport" )
1178+ ? Collections . singletonList ( convertChild ( node , "exportClause" ))
1179+ : convertChildren (node .get ("exportClause" ).getAsJsonObject (), "elements" );
1180+ return new ExportNamedDeclaration ( loc , null , specifiers , source );
11781181 } else {
11791182 return new ExportAllDeclaration (loc , source );
11801183 }
@@ -1187,6 +1190,11 @@ private Node convertExportSpecifier(JsonObject node, SourceLocation loc) throws
11871190 convertChild (node , "name" ));
11881191 }
11891192
1193+ private Node convertNamespaceExport (JsonObject node , SourceLocation loc ) throws ParseError {
1194+ // Convert the "* as ns" from an export declaration.
1195+ return new ExportNamespaceSpecifier (loc , convertChild (node , "name" ));
1196+ }
1197+
11901198 private Node convertExpressionStatement (JsonObject node , SourceLocation loc ) throws ParseError {
11911199 Expression expression = convertChild (node , "expression" );
11921200 return new ExpressionStatement (loc , expression );
0 commit comments