@@ -154,3 +154,39 @@ class ImportStaticTypeMember extends Import {
154154
155155 override string getAPrimaryQlClass ( ) { result = "ImportStaticTypeMember" }
156156}
157+
158+ /**
159+ * A module import declaration, which imports an entire module.
160+ *
161+ * For example, `import module java.base;` imports all packages exported
162+ * by the `java.base module`, making their types available for use.
163+ */
164+ class ModuleImportDeclaration extends Import {
165+ ModuleImportDeclaration ( ) { imports ( this , _, _, 6 ) }
166+
167+ /** Gets the name of the imported module. */
168+ string getModuleName ( ) { imports ( this , _, result , _) }
169+
170+ /** Gets the imported module. */
171+ Module getModule ( ) { result .getName ( ) = this .getModuleName ( ) }
172+
173+ /** Gets an exported package from the imported module. */
174+ Package getAnImportedPackage ( ) {
175+ exists ( ExportsDirective exports |
176+ exports = this .getModule ( ) .getADirective ( ) and
177+ result = exports .getExportedPackage ( )
178+ )
179+ }
180+
181+ /** Gets a type that is imported from the module. */
182+ RefType getAnImportedType ( ) {
183+ exists ( Package pkg |
184+ pkg = this .getAnImportedPackage ( ) and
185+ result .getPackage ( ) = pkg
186+ )
187+ }
188+
189+ override string toString ( ) { result = "import module " + this .getModuleName ( ) }
190+
191+ override string getAPrimaryQlClass ( ) { result = "ModuleImportDeclaration" }
192+ }
0 commit comments