Ruby: add SetterCallNode

This commit is contained in:
Asger F
2022-10-18 13:42:45 +02:00
parent 515b8366d2
commit 2546d09fe2

View File

@@ -150,6 +150,29 @@ class CallNode extends LocalSourceNode, ExprNode {
}
}
/**
* A call to a setter method.
*
* For example,
* ```rb
* self.foo = 10
* a[0] = 10
* ```
*/
class SetterCallNode extends CallNode {
SetterCallNode() { asExpr().getExpr() instanceof SetterMethodCall }
/**
* Gets the name of the method being called without the trailing `=`. For example, in the following
* two statements the target name is `value`:
* ```rb
* foo.value=(1)
* foo.value = 1
* ```
*/
final string getTargetName() { result = asExpr().getExpr().(SetterMethodCall).getTargetName() }
}
/**
* An expression, viewed as a node in a data flow graph.
*