Skip to content

Commit 5099416

Browse files
committed
remove redundant qldoc, and change parameter names to better reflect behavior
1 parent a476fc5 commit 5099416

File tree

1 file changed

+24
-57
lines changed

1 file changed

+24
-57
lines changed

javascript/ql/src/semmle/javascript/Arrays.qll

Lines changed: 24 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,10 @@ private module ArrayDataFlow {
111111
this.getMethodName() = "unshift"
112112
}
113113

114-
/**
115-
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
116-
*/
117-
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
114+
override predicate storeStep(DataFlow::Node element, DataFlow::Node obj, string prop) {
118115
prop = arrayElement() and
119-
(pred = this.getAnArgument() or pred = this.getASpreadArgument()) and
120-
succ = this.getReceiver().getALocalSource()
116+
(element = this.getAnArgument() or element = this.getASpreadArgument()) and
117+
obj = this.getReceiver().getALocalSource()
121118
}
122119
}
123120

@@ -141,22 +138,16 @@ private module ArrayDataFlow {
141138
)
142139
}
143140

144-
/**
145-
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
146-
*/
147-
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
141+
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
148142
prop = arrayElement() and
149-
pred = this.(DataFlow::PropRead).getBase() and
150-
succ = this
143+
obj = this.(DataFlow::PropRead).getBase() and
144+
element = this
151145
}
152146

153-
/**
154-
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
155-
*/
156-
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
147+
override predicate storeStep(DataFlow::Node element, DataFlow::Node obj, string prop) {
157148
prop = arrayElement() and
158-
pred = this.(DataFlow::PropWrite).getRhs() and
159-
this = succ.(DataFlow::SourceNode).getAPropertyWrite()
149+
element = this.(DataFlow::PropWrite).getRhs() and
150+
this = obj.(DataFlow::SourceNode).getAPropertyWrite()
160151
}
161152
}
162153

@@ -170,13 +161,10 @@ private module ArrayDataFlow {
170161
getMethodName() = "shift"
171162
}
172163

173-
/**
174-
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
175-
*/
176-
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
164+
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
177165
prop = arrayElement() and
178-
pred = this.getReceiver() and
179-
succ = this
166+
obj = this.getReceiver() and
167+
element = this
180168
}
181169
}
182170

@@ -196,28 +184,19 @@ private module ArrayDataFlow {
196184
this.getMethodName() = "forEach"
197185
}
198186

199-
/**
200-
* Holds if the property `prop` of the object `pred` should be loaded into `succ`.
201-
*/
202-
override predicate loadStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
187+
override predicate loadStep(DataFlow::Node obj, DataFlow::Node element, string prop) {
203188
prop = arrayElement() and
204-
pred = this.getReceiver() and
205-
succ = getCallback(0).getParameter(0)
189+
obj = this.getReceiver() and
190+
element = getCallback(0).getParameter(0)
206191
}
207192

208-
/**
209-
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
210-
*/
211-
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
193+
override predicate storeStep(DataFlow::Node element, DataFlow::Node obj, string prop) {
212194
this.getMethodName() = "map" and
213195
prop = arrayElement() and
214-
pred = this.getCallback(0).getAReturn() and
215-
succ = this
196+
element = this.getCallback(0).getAReturn() and
197+
obj = this
216198
}
217199

218-
/**
219-
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
220-
*/
221200
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
222201
prop = arrayElement() and
223202
pred = this.getReceiver() and
@@ -233,13 +212,10 @@ private module ArrayDataFlow {
233212
this instanceof DataFlow::ArrayCreationNode
234213
}
235214

236-
/**
237-
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
238-
*/
239-
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
215+
override predicate storeStep(DataFlow::Node element, DataFlow::Node obj, string prop) {
240216
prop = arrayElement() and
241-
pred = this.(DataFlow::ArrayCreationNode).getAnElement() and
242-
succ = this
217+
element = this.(DataFlow::ArrayCreationNode).getAnElement() and
218+
obj = this
243219
}
244220
}
245221

@@ -250,13 +226,10 @@ private module ArrayDataFlow {
250226
private class ArraySpliceStep extends DataFlow::AdditionalFlowStep, DataFlow::MethodCallNode {
251227
ArraySpliceStep() { this.getMethodName() = "splice" }
252228

253-
/**
254-
* Holds if `pred` should be stored in the object `succ` under the property `prop`.
255-
*/
256-
override predicate storeStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
229+
override predicate storeStep(DataFlow::Node element, DataFlow::Node obj, string prop) {
257230
prop = arrayElement() and
258-
pred = getArgument(2) and
259-
succ = this.getReceiver().getALocalSource()
231+
element = getArgument(2) and
232+
obj = this.getReceiver().getALocalSource()
260233
}
261234
}
262235

@@ -267,9 +240,6 @@ private module ArrayDataFlow {
267240
private class ArrayConcatStep extends DataFlow::AdditionalFlowStep, DataFlow::MethodCallNode {
268241
ArrayConcatStep() { this.getMethodName() = "concat" }
269242

270-
/**
271-
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
272-
*/
273243
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
274244
prop = arrayElement() and
275245
(pred = this.getReceiver() or pred = this.getAnArgument()) and
@@ -287,9 +257,6 @@ private module ArrayDataFlow {
287257
this.getMethodName() = "filter"
288258
}
289259

290-
/**
291-
* Holds if the property `prop` should be copied from the object `pred` to the object `succ`.
292-
*/
293260
override predicate loadStoreStep(DataFlow::Node pred, DataFlow::Node succ, string prop) {
294261
prop = arrayElement() and
295262
pred = this.getReceiver() and

0 commit comments

Comments
 (0)