Skip to content

Commit 06103f4

Browse files
committed
Python: Consistently use attribute/attr
1 parent 7108d28 commit 06103f4

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

python/ql/src/experimental/dataflow/TypeTracker.qll

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class StepSummary extends TStepSummary {
3939
or
4040
this instanceof ReturnStep and result = "return"
4141
or
42-
exists(string prop | this = StoreStep(prop) | result = "store " + prop)
42+
exists(string attr | this = StoreStep(attr) | result = "store " + attr)
4343
or
44-
exists(string prop | this = LoadStep(prop) | result = "load " + prop)
44+
exists(string attr | this = LoadStep(attr) | result = "load " + attr)
4545
}
4646
}
4747

@@ -132,7 +132,7 @@ class Boolean extends boolean {
132132
Boolean() { this = true or this = false }
133133
}
134134

135-
private newtype TTypeTracker = MkTypeTracker(Boolean hasCall, OptionalAttributeName prop)
135+
private newtype TTypeTracker = MkTypeTracker(Boolean hasCall, OptionalAttributeName attr)
136136

137137
/**
138138
* Summary of the steps needed to track a value to a given dataflow node.
@@ -163,54 +163,54 @@ private newtype TTypeTracker = MkTypeTracker(Boolean hasCall, OptionalAttributeN
163163
*/
164164
class TypeTracker extends TTypeTracker {
165165
Boolean hasCall;
166-
OptionalAttributeName prop;
166+
OptionalAttributeName attr;
167167

168-
TypeTracker() { this = MkTypeTracker(hasCall, prop) }
168+
TypeTracker() { this = MkTypeTracker(hasCall, attr) }
169169

170170
/** Gets the summary resulting from appending `step` to this type-tracking summary. */
171171
cached
172172
TypeTracker append(StepSummary step) {
173173
step = LevelStep() and result = this
174174
or
175-
step = CallStep() and result = MkTypeTracker(true, prop)
175+
step = CallStep() and result = MkTypeTracker(true, attr)
176176
or
177177
step = ReturnStep() and hasCall = false and result = this
178178
or
179-
step = LoadStep(prop) and result = MkTypeTracker(hasCall, "")
179+
step = LoadStep(attr) and result = MkTypeTracker(hasCall, "")
180180
or
181-
exists(string p | step = StoreStep(p) and prop = "" and result = MkTypeTracker(hasCall, p))
181+
exists(string p | step = StoreStep(p) and attr = "" and result = MkTypeTracker(hasCall, p))
182182
}
183183

184184
/** Gets a textual representation of this summary. */
185185
string toString() {
186-
exists(string withCall, string withProp |
186+
exists(string withCall, string withAttr |
187187
(if hasCall = true then withCall = "with" else withCall = "without") and
188-
(if prop != "" then withProp = " with property " + prop else withProp = "") and
189-
result = "type tracker " + withCall + " call steps" + withProp
188+
(if attr != "" then withAttr = " with attribute " + attr else withAttr = "") and
189+
result = "type tracker " + withCall + " call steps" + withAttr
190190
)
191191
}
192192

193193
/**
194194
* Holds if this is the starting point of type tracking.
195195
*/
196-
predicate start() { hasCall = false and prop = "" }
196+
predicate start() { hasCall = false and attr = "" }
197197

198198
/**
199-
* Holds if this is the starting point of type tracking, and the value starts in the property named `propName`.
200-
* The type tracking only ends after the property has been loaded.
199+
* Holds if this is the starting point of type tracking, and the value starts in the attribute named `attrName`.
200+
* The type tracking only ends after the attribute has been loaded.
201201
*/
202-
predicate startInProp(AttributeName propName) { hasCall = false and prop = propName }
202+
predicate startInAttr(AttributeName attrName) { hasCall = false and attr = attrName }
203203

204204
/**
205205
* Holds if this is the starting point of type tracking
206206
* when tracking a parameter into a call, but not out of it.
207207
*/
208-
predicate call() { hasCall = true and prop = "" }
208+
predicate call() { hasCall = true and attr = "" }
209209

210210
/**
211211
* Holds if this is the end point of type tracking.
212212
*/
213-
predicate end() { prop = "" }
213+
predicate end() { attr = "" }
214214

215215
/**
216216
* INTERNAL. DO NOT USE.
@@ -222,17 +222,17 @@ class TypeTracker extends TTypeTracker {
222222
/**
223223
* INTERNAL. DO NOT USE.
224224
*
225-
* Gets the property associated with this type tracker.
225+
* Gets the attribute associated with this type tracker.
226226
*/
227-
string getProp() { result = prop }
227+
string getAttr() { result = attr }
228228

229229
/**
230230
* Gets a type tracker that starts where this one has left off to allow continued
231231
* tracking.
232232
*
233-
* This predicate is only defined if the type has not been tracked into a property.
233+
* This predicate is only defined if the type has not been tracked into an attribute.
234234
*/
235-
TypeTracker continue() { prop = "" and result = this }
235+
TypeTracker continue() { attr = "" and result = this }
236236

237237
/**
238238
* Gets the summary that corresponds to having taken a forwards
@@ -251,7 +251,7 @@ class TypeTracker extends TTypeTracker {
251251
* local, heap and/or inter-procedural step from `pred` to `succ`.
252252
*
253253
* Unlike `TypeTracker::step`, this predicate exposes all edges
254-
* in the flow graph, and not just the edges between `SourceNode`s.
254+
* in the flow graph, and not just the edges between `Node`s.
255255
* It may therefore be less performant.
256256
*
257257
* Type tracking predicates using small steps typically take the following form:

0 commit comments

Comments
 (0)