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