mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Ruby: add SetterCallNode
This commit is contained in:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user