Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 31596ef

Browse files
committed
Python: Clean up and extend built-in call node classes
1 parent e9ecc00 commit 31596ef

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

python/ql/src/experimental/dataflow/internal/Attributes.qll

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private class BuiltInCallNode extends CallNode {
7474
string name;
7575

7676
BuiltInCallNode() {
77-
// TODO disallow instances where `setattr` may refer to an in-scope variable of that name.
77+
// TODO disallow instances where the name of the built-in may refer to an in-scope variable of that name.
7878
exists(NameNode id | this.getFunction() = id and id.getId() = name and id.isGlobal()) and
7979
name = any(Builtin b).getName()
8080
}
@@ -85,14 +85,10 @@ private class BuiltInCallNode extends CallNode {
8585

8686
/**
8787
* Represents a call to the built-ins that handle dynamic inspection and modification of
88-
* attributes: `getattr`, `setattr`, and `hasattr`.
88+
* attributes: `getattr`, `setattr`, `hasattr`, and `delattr`.
8989
*/
9090
private class BuiltinAttrCallNode extends BuiltInCallNode {
91-
BuiltinAttrCallNode() {
92-
name = "setattr" or
93-
name = "getattr" or
94-
name = "hasattr"
95-
}
91+
BuiltinAttrCallNode() { name in ["setattr", "getattr", "hasattr", "delattr"] }
9692

9793
/** Gets the control flow node for object on which the attribute is accessed. */
9894
ControlFlowNode getObject() { result in [this.getArg(0), this.getArgByName("object")] }

0 commit comments

Comments
 (0)