5252import com .semmle .js .ast .ImportDeclaration ;
5353import com .semmle .js .ast .ImportDefaultSpecifier ;
5454import com .semmle .js .ast .ImportNamespaceSpecifier ;
55+ import com .semmle .js .ast .ImportPhaseModifier ;
5556import com .semmle .js .ast .ImportSpecifier ;
5657import com .semmle .js .ast .InvokeExpression ;
5758import com .semmle .js .ast .LabeledStatement ;
@@ -1404,7 +1405,7 @@ private Node convertImportDeclaration(JsonObject node, SourceLocation loc) throw
14041405 Literal src = tryConvertChild (node , "moduleSpecifier" , Literal .class );
14051406 Expression attributes = convertChild (node , "attributes" );
14061407 List <ImportSpecifier > specifiers = new ArrayList <>();
1407- boolean hasTypeKeyword = false ;
1408+ ImportPhaseModifier phaseModifier = ImportPhaseModifier . NONE ;
14081409 if (hasChild (node , "importClause" )) {
14091410 JsonObject importClause = node .get ("importClause" ).getAsJsonObject ();
14101411 if (hasChild (importClause , "name" )) {
@@ -1418,10 +1419,22 @@ private Node convertImportDeclaration(JsonObject node, SourceLocation loc) throw
14181419 specifiers .addAll (convertChildren (namedBindings , "elements" ));
14191420 }
14201421 }
1421- hasTypeKeyword = importClause .get ("isTypeOnly" ).getAsBoolean ();
1422+ if (hasChild (importClause , "phaseModifier" )) {
1423+ String name = metadata .getSyntaxKindName (importClause .get ("phaseModifier" ).getAsInt ());
1424+ switch (name ) {
1425+ case "DeferKeyword" : {
1426+ phaseModifier = ImportPhaseModifier .DEFER ;
1427+ break ;
1428+ }
1429+ case "TypeKeyword" : {
1430+ phaseModifier = ImportPhaseModifier .TYPE ;
1431+ break ;
1432+ }
1433+ }
1434+ }
14221435 }
14231436 ImportDeclaration importDecl =
1424- new ImportDeclaration (loc , specifiers , src , attributes , hasTypeKeyword );
1437+ new ImportDeclaration (loc , specifiers , src , attributes , phaseModifier );
14251438 attachSymbolInformation (importDecl , node );
14261439 return importDecl ;
14271440 }
0 commit comments