Skip to content

Commit d5eacf8

Browse files
committed
C#: Change expected output. Address review comments.
1 parent 3718237 commit d5eacf8

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

csharp/ql/src/semmle/code/csharp/Stmt.qll

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -250,24 +250,23 @@ class SwitchStmt extends SelectionStmt, @switch_stmt {
250250
* A `case` statement. Either a constant case (`ConstCase`), a type matching
251251
* case (`TypeCase`), or a `default` case (`DefaultCase`).
252252
*/
253-
class CaseStmt extends Stmt, @case
254-
{
253+
class CaseStmt extends Stmt, @case {
255254
/**
256255
* Gets the condition on this case, if any. For example, the type case on line 3
257-
* has no condition, and the type case on line 4 has condition `s.Length>0`, in
256+
* has no condition, and the type case on line 4 has condition `s.Length > 0`, in
258257
*
259258
* ```
260259
* switch(p)
261260
* {
262261
* case int i:
263-
* case string s when s.Length>0:
262+
* case string s when s.Length > 0:
264263
* break;
265264
* ...
266265
* }
267266
* ```
268267
*/
269268
Expr getCondition() {
270-
result = getChild(2)
269+
result = this.getChild(2)
271270
}
272271
}
273272

@@ -300,13 +299,13 @@ class ConstCase extends LabeledStmt, CaseStmt {
300299

301300
/**
302301
* A type matching case in a `switch` statement, for example `case int i:` on line 3 or
303-
* `case string s when s.Length>0:` on line 4 in
302+
* `case string s when s.Length > 0:` on line 4 in
304303
*
305304
* ```
306305
* switch(p)
307306
* {
308307
* case int i:
309-
* case string s when s.Length>0:
308+
* case string s when s.Length > 0:
310309
* break;
311310
* ...
312311
* }

csharp/ql/src/semmle/code/csharp/controlflow/Completion.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ private predicate inBooleanContext(Expr e, boolean isBooleanCompletionForParent)
309309
isBooleanCompletionForParent = false
310310
)
311311
or
312-
exists(CaseStmt tc |
313-
tc.getCondition() = e |
312+
exists(CaseStmt cs |
313+
cs.getCondition() = e |
314314
isBooleanCompletionForParent = false
315315
)
316316
or

csharp/ql/src/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,8 +1589,8 @@ module ControlFlow {
15891589
}
15901590

15911591
pragma [nomagic]
1592-
private ControlFlowElement lastCaseCondition(CaseStmt tc, Completion c) {
1593-
result = last(tc.getCondition(), c)
1592+
private ControlFlowElement lastCaseCondition(CaseStmt cs, Completion c) {
1593+
result = last(cs.getCondition(), c)
15941594
}
15951595

15961596
pragma [nomagic]

csharp/ql/test/library-tests/linq/Linq1.expected

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@
1717
| queries.cs:18:21:21:28 | call to method Select | 1 | queries.cs:21:18:21:27 | (...) => ... |
1818
| queries.cs:25:11:25:21 | call to method SelectMany | 0 | queries.cs:24:11:24:25 | IList<Int32> a = ... |
1919
| queries.cs:25:11:25:21 | call to method SelectMany | 1 | queries.cs:25:11:25:21 | IList<Int32> b = ... |
20-
| queries.cs:25:11:25:21 | call to method SelectMany | 3 | queries.cs:25:21:25:21 | access to local variable a |
20+
| queries.cs:25:11:25:21 | call to method SelectMany | 2 | queries.cs:25:21:25:21 | access to local variable a |
2121
| queries.cs:26:11:26:26 | call to method Select | 0 | queries.cs:25:11:25:21 | call to method SelectMany |
2222
| queries.cs:26:11:26:26 | call to method Select | 1 | queries.cs:26:11:26:26 | Int32 next = ... |
23-
| queries.cs:26:11:26:26 | call to method Select | 3 | queries.cs:26:22:26:26 | ... + ... |
23+
| queries.cs:26:11:26:26 | call to method Select | 2 | queries.cs:26:22:26:26 | ... + ... |
2424
| queries.cs:27:11:27:42 | call to method Join | 0 | queries.cs:26:11:26:26 | call to method Select |
2525
| queries.cs:27:11:27:42 | call to method Join | 1 | queries.cs:27:11:27:42 | IList<Int32> c = ... |
26-
| queries.cs:27:11:27:42 | call to method Join | 3 | queries.cs:27:21:27:25 | access to local variable list1 |
27-
| queries.cs:27:11:27:42 | call to method Join | 4 | queries.cs:27:30:27:33 | access to local variable next |
28-
| queries.cs:27:11:27:42 | call to method Join | 5 | queries.cs:27:42:27:42 | access to local variable c |
26+
| queries.cs:27:11:27:42 | call to method Join | 2 | queries.cs:27:21:27:25 | access to local variable list1 |
27+
| queries.cs:27:11:27:42 | call to method Join | 3 | queries.cs:27:30:27:33 | access to local variable next |
28+
| queries.cs:27:11:27:42 | call to method Join | 4 | queries.cs:27:42:27:42 | access to local variable c |
2929
| queries.cs:32:11:32:21 | call to method SelectMany | 0 | queries.cs:31:11:31:25 | IList<Int32> a = ... |
3030
| queries.cs:32:11:32:21 | call to method SelectMany | 1 | queries.cs:32:11:32:21 | IList<Int32> b = ... |
31-
| queries.cs:32:11:32:21 | call to method SelectMany | 3 | queries.cs:32:21:32:21 | access to local variable a |
31+
| queries.cs:32:11:32:21 | call to method SelectMany | 2 | queries.cs:32:21:32:21 | access to local variable a |
3232
| queries.cs:33:11:33:26 | call to method Select | 0 | queries.cs:32:11:32:21 | call to method SelectMany |
3333
| queries.cs:33:11:33:26 | call to method Select | 1 | queries.cs:33:11:33:26 | Int32 next = ... |
34-
| queries.cs:33:11:33:26 | call to method Select | 3 | queries.cs:33:22:33:26 | ... + ... |
34+
| queries.cs:33:11:33:26 | call to method Select | 2 | queries.cs:33:22:33:26 | ... + ... |
3535
| queries.cs:34:11:34:37 | call to method OrderByDescending | 0 | queries.cs:33:11:33:26 | call to method Select |
3636
| queries.cs:34:11:34:37 | call to method OrderByDescending | 1 | queries.cs:34:19:34:26 | ... * ... |
3737
| queries.cs:35:11:35:25 | call to method GroupBy | 0 | queries.cs:34:11:34:37 | call to method OrderByDescending |
@@ -45,7 +45,7 @@
4545
| queries.cs:51:11:51:18 | call to method Select | 1 | queries.cs:51:18:51:18 | access to local variable a |
4646
| queries.cs:55:11:55:49 | call to method GroupJoin | 0 | queries.cs:54:11:54:25 | Int32 a = ... |
4747
| queries.cs:55:11:55:49 | call to method GroupJoin | 1 | queries.cs:55:11:55:49 | IList<IList<Int32>> c = ... |
48-
| queries.cs:55:11:55:49 | call to method GroupJoin | 2 | queries.cs:55:11:55:49 | IList<IList<Int32>> d = ... |
49-
| queries.cs:55:11:55:49 | call to method GroupJoin | 3 | queries.cs:55:21:55:25 | access to local variable list2 |
50-
| queries.cs:55:11:55:49 | call to method GroupJoin | 4 | queries.cs:55:30:55:30 | access to local variable a |
51-
| queries.cs:55:11:55:49 | call to method GroupJoin | 5 | queries.cs:55:39:55:42 | access to indexer |
48+
| queries.cs:55:11:55:49 | call to method GroupJoin | 2 | queries.cs:55:21:55:25 | access to local variable list2 |
49+
| queries.cs:55:11:55:49 | call to method GroupJoin | 3 | queries.cs:55:30:55:30 | access to local variable a |
50+
| queries.cs:55:11:55:49 | call to method GroupJoin | 4 | queries.cs:55:39:55:42 | access to indexer |
51+
| queries.cs:55:11:55:49 | call to method GroupJoin | 5 | queries.cs:55:11:55:49 | IList<IList<Int32>> d = ... |

0 commit comments

Comments
 (0)