@@ -67,16 +67,6 @@ class NodeModule extends Module {
6767 result = this .getExportsSourceNode ( ) .getALocalUse ( )
6868 }
6969
70- /** Gets a symbol exported by this module. */
71- override string getAnExportedSymbol ( ) {
72- result = super .getAnExportedSymbol ( )
73- or
74- result = this .getAnImplicitlyExportedSymbol ( )
75- or
76- // getters and the like.
77- result = this .getExportsSourceNode ( ) .getAPropertyWrite ( ) .getPropertyName ( )
78- }
79-
8070 override DataFlow:: Node getAnExportedValue ( string name ) {
8171 // a property write whose base is `exports` or `module.exports`
8272 result = this .getExportsSourceNode ( ) .getAPropertyWrite ( name ) .getRhs ( )
@@ -126,29 +116,6 @@ class NodeModule extends Module {
126116 )
127117 }
128118
129- /** Gets a symbol that the module object inherits from its prototypes. */
130- private string getAnImplicitlyExportedSymbol ( ) {
131- exists ( ExternalConstructor ec | ec = this .getPrototypeOfExportedExpr ( ) |
132- result = ec .getAMember ( ) .getName ( )
133- or
134- ec instanceof FunctionExternal and result = "prototype"
135- or
136- ec instanceof ArrayExternal and
137- exists ( NumberLiteral nl | result = nl .getValue ( ) and exists ( result .toInt ( ) ) )
138- )
139- }
140-
141- /** Gets an externs declaration of the prototype object of a value exported by this module. */
142- private ExternalConstructor getPrototypeOfExportedExpr ( ) {
143- exists ( AbstractValue exported | exported = this .getAModuleExportsValue ( ) |
144- result instanceof ObjectExternal
145- or
146- exported instanceof AbstractFunction and result instanceof FunctionExternal
147- or
148- exported instanceof AbstractOtherObject and result instanceof ArrayExternal
149- )
150- }
151-
152119 deprecated override predicate searchRoot ( PathExpr path , Folder searchRoot , int priority ) {
153120 path .getEnclosingModule ( ) = this and
154121 exists ( string pathval | pathval = path .getValue ( ) |
@@ -184,21 +151,6 @@ private DataFlow::SourceNode getASourceProp(DynamicPropertyAccess::EnumeratedPro
184151 )
185152}
186153
187- /**
188- * Gets an expression that syntactically could be a alias for `module.exports`.
189- * This predicate exists to reduce the size of `getAModuleExportsNode`,
190- * while keeping all the tuples that could be relevant in later computations.
191- */
192- pragma [ noinline]
193- private DataFlow:: Node getAModuleExportsCandidate ( ) {
194- // A bit of manual magic
195- result = any ( DataFlow:: PropWrite w ) .getBase ( )
196- or
197- result = DataFlow:: valueNode ( any ( PropAccess p | exists ( p .getPropertyName ( ) ) ) .getBase ( ) )
198- or
199- result = DataFlow:: valueNode ( any ( ObjectExpr obj ) )
200- }
201-
202154/**
203155 * Holds if `nodeModules` is a folder of the form `<prefix>/node_modules`, where
204156 * `<prefix>` is a (not necessarily proper) prefix of `f` and does not end in `/node_modules`,
0 commit comments