@@ -70,26 +70,40 @@ module GlobalId {
7070 }
7171 }
7272
73- // TODO: methods in this module are available to any class that includes it, not just ActiveRecord models
7473 /** `GlobalID::Identification` */
7574 module Identification {
75+ /** A `DataFlow::CallNode` against an instance of a class that includes the `GlobalID::Identification` module */
76+ private class IdentificationInstanceCall extends DataFlow:: CallNode {
77+ IdentificationInstanceCall ( ) {
78+ this =
79+ DataFlow:: getConstant ( "GlobalID" )
80+ .getConstant ( "Identification" )
81+ .getADescendentModule ( )
82+ .getAnImmediateReference ( )
83+ .getAMethodCall ( [ "new" , "find" ] )
84+ .getAMethodCall ( )
85+ or
86+ this instanceof ActiveRecordInstanceMethodCall
87+ }
88+ }
89+
7690 /** A call to `GlobalID::Identification.to_global_id` */
77- class ToGlobalIdCall extends ActiveRecordInstanceMethodCall {
91+ class ToGlobalIdCall extends IdentificationInstanceCall {
7892 ToGlobalIdCall ( ) { this .getMethodName ( ) = [ "to_global_id" , "to_gid" ] }
7993 }
8094
8195 /** A call to `GlobalID::Identification.to_gid_param` */
82- class ToGidParamCall extends ActiveRecordInstanceMethodCall {
96+ class ToGidParamCall extends DataFlow :: CallNode {
8397 ToGidParamCall ( ) { this .getMethodName ( ) = "to_gid_param" }
8498 }
8599
86100 /** A call to `GlobalID::Identification.to_signed_global_id` */
87- class ToSignedGlobalIdCall extends ActiveRecordInstanceMethodCall {
101+ class ToSignedGlobalIdCall extends DataFlow :: CallNode {
88102 ToSignedGlobalIdCall ( ) { this .getMethodName ( ) = [ "to_signed_global_id" , "to_sgid" ] }
89103 }
90104
91105 /** A call to `GlobalID::Identification.to_sgid_param` */
92- class ToSgidParamCall extends ActiveRecordInstanceMethodCall {
106+ class ToSgidParamCall extends DataFlow :: CallNode {
93107 ToSgidParamCall ( ) { this .getMethodName ( ) = "to_sgid_param" }
94108 }
95109 }
0 commit comments