@@ -725,8 +725,15 @@ module ClassNode {
725725 */
726726 class FunctionStyleClass extends Range , DataFlow:: ValueNode {
727727 override Function astNode ;
728+ AbstractFunction function ;
728729
729- FunctionStyleClass ( ) { exists ( getAPropertyReference ( "prototype" ) ) }
730+ FunctionStyleClass ( ) {
731+ function .getFunction ( ) = astNode and
732+ exists ( DataFlow:: PropRef read |
733+ read .getPropertyName ( ) = "prototype" and
734+ read .getBase ( ) .analyze ( ) .getAValue ( ) = function
735+ )
736+ }
730737
731738 override string getName ( ) { result = astNode .getName ( ) }
732739
@@ -775,14 +782,16 @@ module ClassNode {
775782 /**
776783 * Gets a reference to the prototype of this class.
777784 */
778- private DataFlow:: SourceNode getAPrototypeReference ( ) {
779- result = getAPropertyRead ( "prototype" )
780- or
781- result = getAPropertySource ( "prototype" )
782- or
783- exists ( ExtendCall call |
784- call .getDestinationOperand ( ) = getAPropertyRead ( "prototype" ) and
785- result = call .getASourceOperand ( )
785+ DataFlow:: SourceNode getAPrototypeReference ( ) {
786+ exists ( DataFlow:: SourceNode base | base .analyze ( ) .getAValue ( ) = function |
787+ result = base .getAPropertyRead ( "prototype" )
788+ or
789+ result = base .getAPropertySource ( "prototype" )
790+ or
791+ exists ( ExtendCall call |
792+ call .getDestinationOperand ( ) = base .getAPropertyRead ( "prototype" ) and
793+ result = call .getASourceOperand ( )
794+ )
786795 )
787796 }
788797
0 commit comments