@@ -1203,27 +1203,35 @@ private Node convertExportDeclaration(JsonObject node, SourceLocation loc) throw
1203
1203
Literal source = tryConvertChild (node , "moduleSpecifier" , Literal .class );
1204
1204
Expression attributes = convertChild (node , "attributes" );
1205
1205
if (hasChild (node , "exportClause" )) {
1206
+ JsonElement exportClauseNode = node .get ("exportClause" );
1206
1207
boolean hasTypeKeyword = node .get ("isTypeOnly" ).getAsBoolean ();
1208
+ boolean isNamespaceExportNode = hasKind (exportClauseNode , "NamespaceExport" );
1207
1209
List <ExportSpecifier > specifiers =
1208
- hasKind ( node . get ( "exportClause" ), "NamespaceExport" )
1210
+ isNamespaceExportNode
1209
1211
? Collections .singletonList (convertChild (node , "exportClause" ))
1210
- : convertChildren (node . get ( "exportClause" ) .getAsJsonObject (), "elements" );
1212
+ : convertChildren (exportClauseNode .getAsJsonObject (), "elements" );
1211
1213
return new ExportNamedDeclaration (loc , null , specifiers , source , attributes , hasTypeKeyword );
1212
1214
} else {
1213
1215
return new ExportAllDeclaration (loc , source , attributes );
1214
1216
}
1215
1217
}
1216
1218
1217
1219
private Node convertExportSpecifier (JsonObject node , SourceLocation loc ) throws ParseError {
1220
+ Identifier local = convertChild (node , hasChild (node , "propertyName" ) ? "propertyName" : "name" );
1221
+ JsonObject exportedToken = node .get ("name" ).getAsJsonObject ();
1222
+ Identifier exported = convertNodeAsIdentifier (exportedToken );
1223
+
1218
1224
return new ExportSpecifier (
1219
1225
loc ,
1220
- convertChild ( node , hasChild ( node , "propertyName" ) ? "propertyName" : "name" ) ,
1221
- convertChild ( node , "name" ) );
1226
+ local ,
1227
+ exported );
1222
1228
}
1223
1229
1224
1230
private Node convertNamespaceExport (JsonObject node , SourceLocation loc ) throws ParseError {
1225
1231
// Convert the "* as ns" from an export declaration.
1226
- return new ExportNamespaceSpecifier (loc , convertChild (node , "name" ));
1232
+ JsonObject exportedNamespaceToken = node .get ("name" ).getAsJsonObject ();
1233
+ Identifier exportedNamespaceIdentifier = convertNodeAsIdentifier (exportedNamespaceToken );
1234
+ return new ExportNamespaceSpecifier (loc , exportedNamespaceIdentifier );
1227
1235
}
1228
1236
1229
1237
private Node convertExpressionStatement (JsonObject node , SourceLocation loc ) throws ParseError {
@@ -1431,7 +1439,8 @@ private Node convertImportKeyword(SourceLocation loc) {
1431
1439
1432
1440
private Node convertImportSpecifier (JsonObject node , SourceLocation loc ) throws ParseError {
1433
1441
boolean hasImported = hasChild (node , "propertyName" );
1434
- Identifier imported = convertChild (node , hasImported ? "propertyName" : "name" );
1442
+ JsonObject importedToken = node .get (hasImported ? "propertyName" : "name" ).getAsJsonObject ();
1443
+ Identifier imported = convertNodeAsIdentifier (importedToken );
1435
1444
Identifier local = convertChild (node , "name" );
1436
1445
boolean isTypeOnly = node .get ("isTypeOnly" ).getAsBoolean () == true ;
1437
1446
return new ImportSpecifier (loc , imported , local , isTypeOnly );
0 commit comments