Skip to content

Commit fe3645f

Browse files
author
AndreiDiaconu1
committed
Fix some PR comments
1 parent db213bb commit fe3645f

File tree

3 files changed

+8
-20
lines changed

3 files changed

+8
-20
lines changed

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class TranslatedCall extends TranslatedExpr, TranslatedCallBlueprint {
2828
/**
2929
* Represents the IR translation of a direct function call. The call can be one of the following:
3030
* `MethodCall`, `LocalFunctionCall`, `AccessorCall`, `OperatorCall`.
31-
* Note that `DelegateCall`s are not treated here since they need
31+
* Note that `DelegateCall`s are not treated here since they need to be desugared.
3232
*/
3333

3434
class TranslatedFunctionCall extends TranslatedNonConstantExpr, TranslatedCall {

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/desugar/Delegate.qll

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,11 @@ private import semmle.code.csharp.ir.implementation.raw.internal.common.Translat
2929
*/
3030
module DelegateElements {
3131
TranslatedDelegateConstructorCall getConstructor(DelegateCreation generatedBy) {
32-
exists(TranslatedDelegateConstructorCall cons |
33-
cons.getAST() = generatedBy and
34-
result = cons
35-
)
32+
result.getAST() = generatedBy
3633
}
3734

3835
TranslatedDelegateInvokeCall getInvoke(DelegateCall generatedBy) {
39-
exists(TranslatedDelegateInvokeCall invoke |
40-
invoke.getAST() = generatedBy and
41-
result = invoke
42-
)
36+
result.getAST() = generatedBy
4337
}
4438
}
4539

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/desugar/Foreach.qll

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* File that provides the desugaring of a `Foreach` stmt.
33
* Since Roslyn rewrites it in quite a few ways,
4-
* for now I will only desugar it to a "canonical" form.
4+
* for now only desugar it to a "canonical" form.
55
* Also we only deal with foreach stmts where there is only
6-
* one declaration (see bellow).
6+
* one declaration (see below).
77
* For example the code:
88
* ```
99
* foreach(var item in some_enumerable) {
@@ -58,18 +58,12 @@ private import internal.TranslatedCompilerGeneratedElement
5858
* Module that exposes the functions needed for the translation of the `foreach` stmt.
5959
*/
6060
module ForeachElements {
61-
TranslatedForeachTry getTry(ForeachStmt generatedBy) {
62-
exists(TranslatedForeachTry try |
63-
try.getAST() = generatedBy and
64-
result = try
65-
)
61+
TranslatedForeachTry getTry(ForeachStmt generatedBy) {
62+
result.getAST() = generatedBy
6663
}
6764

6865
TranslatedForeachEnum getEnumDecl(ForeachStmt generatedBy) {
69-
exists(TranslatedForeachEnum enum |
70-
enum.getAST() = generatedBy and
71-
result = enum
72-
)
66+
result.getAST() = generatedBy
7367
}
7468
}
7569

0 commit comments

Comments
 (0)