@@ -97,7 +97,7 @@ class NodeModule extends Module {
97
97
// }
98
98
exists ( DynamicPropertyAccess:: EnumeratedPropName read , Import imp , DataFlow:: PropWrite write |
99
99
read .getSourceObject ( ) .getALocalSource ( ) .asExpr ( ) = imp and
100
- read . getASourceProp ( ) = write .getRhs ( ) and
100
+ getASourceProp ( read ) = write .getRhs ( ) and
101
101
write .getBase ( ) = this .getAModuleExportsNode ( ) and
102
102
write .getPropertyNameExpr ( ) .flow ( ) .getImmediatePredecessor * ( ) = read and
103
103
result = imp .getImportedModule ( ) .getAnExportedValue ( name )
@@ -163,6 +163,21 @@ class NodeModule extends Module {
163
163
}
164
164
}
165
165
166
+ // An copy of `DynamicPropertyAccess::EnumeratedPropName::getASourceProp` that doesn't use the callgraph.
167
+ // This avoids making the module-imports recursive with the callgraph.
168
+ private DataFlow:: SourceNode getASourceProp ( DynamicPropertyAccess:: EnumeratedPropName prop ) {
169
+ exists ( DataFlow:: Node base , DataFlow:: Node key |
170
+ exists ( DynamicPropertyAccess:: DynamicPropRead read |
171
+ not read .hasDominatingAssignment ( ) and
172
+ base = read .getBase ( ) and
173
+ key = read .getPropertyNameNode ( ) and
174
+ result = read
175
+ ) and
176
+ prop .getASourceObjectRef ( ) .flowsTo ( base ) and
177
+ key .getImmediatePredecessor * ( ) = prop
178
+ )
179
+ }
180
+
166
181
/**
167
182
* Gets an expression that syntactically could be a alias for `module.exports`.
168
183
* This predicate exists to reduce the size of `getAModuleExportsNode`,
0 commit comments