File tree Expand file tree Collapse file tree
test/library-tests/dataflow/api-graphs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ module API {
8888 * This predicate may have multiple results when there are multiple constructor calls invoking this API component.
8989 * Consider using `getAnInstantiation()` if there is a need to distinguish between individual constructor calls.
9090 */
91- Node getInstance ( ) { result = this .getASubclass ( ) .getASuccessor ( Label :: instance ( ) ) }
91+ Node getInstance ( ) { result = this .getASubclass ( ) .getReturn ( "new" ) }
9292
9393 /**
9494 * Gets a node representing the result of calling a method on the receiver represented by this node.
@@ -307,15 +307,6 @@ module API {
307307 node .asExpr ( ) = call .getReceiver ( ) and
308308 name = call .getExpr ( ) .getMethodName ( ) and
309309 lbl = Label:: return ( name ) and
310- name != "new" and
311- ref .asExpr ( ) = call
312- )
313- or
314- // Calling the `new` method on a node that is a use of `base`, which creates a new instance
315- exists ( ExprNodes:: MethodCallCfgNode call |
316- node .asExpr ( ) = call .getReceiver ( ) and
317- lbl = Label:: instance ( ) and
318- call .getExpr ( ) .getMethodName ( ) = "new" and
319310 ref .asExpr ( ) = call
320311 )
321312 }
@@ -439,9 +430,6 @@ private module Label {
439430 /** Gets the `member` edge label for the unknown member. */
440431 string unknownMember ( ) { result = "getUnknownMember()" }
441432
442- /** Gets the `instance` edge label. */
443- string instance ( ) { result = "instance" }
444-
445433 /** Gets the `return` edge label. */
446434 bindingset [ m]
447435 bindingset [ result ]
Original file line number Diff line number Diff line change @@ -2,5 +2,5 @@ classMethodCalls
22| test1.rb:58:1:58:8 | Use getMember("M1").getMember("C1").getReturn("m") |
33| test1.rb:59:1:59:8 | Use getMember("M2").getMember("C3").getReturn("m") |
44instanceMethodCalls
5- | test1.rb:61:1:61:12 | Use getMember("M1").getMember("C1").instance .getReturn("m") |
6- | test1.rb:62:1:62:12 | Use getMember("M2").getMember("C3").instance .getReturn("m") |
5+ | test1.rb:61:1:61:12 | Use getMember("M1").getMember("C1").getReturn("new") .getReturn("m") |
6+ | test1.rb:62:1:62:12 | Use getMember("M2").getMember("C3").getReturn("new") .getReturn("m") |
Original file line number Diff line number Diff line change 99rescue AttributeError => e #$ use=getMember("AttributeError")
1010 Kernel . print ( e ) #$ use=getMember("Kernel").getReturn("print")
1111end
12- Unknown . new . run #$ use=getMember("Unknown").instance .getReturn("run")
12+ Unknown . new . run #$ use=getMember("Unknown").getReturn("new") .getReturn("run")
1313Foo ::Bar ::Baz #$ use=getMember("Foo").getMember("Bar").getMember("Baz")
1414
1515Const = [ 1 , 2 , 3 ] #$ use=getMember("Array").getReturn("[]")
You can’t perform that action at this time.
0 commit comments