Skip to content

Commit 3162e12

Browse files
committed
C#: Redefine ControlFlowElement::getAssembly
1 parent 5102fcd commit 3162e12

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import csharp
44
private import semmle.code.csharp.ExprOrStmtParent
5+
private import semmle.code.csharp.commons.Compilation
56
private import ControlFlow
67
private import ControlFlow::BasicBlocks
78
private import SuccessorTypes
@@ -22,7 +23,12 @@ class ControlFlowElement extends ExprOrStmtParent, @control_flow_element {
2223
Callable getEnclosingCallable() { none() }
2324

2425
/** Gets the assembly that this element was compiled into. */
25-
Assembly getAssembly() { result = this.getEnclosingCallable().getDeclaringType().getALocation() }
26+
Assembly getAssembly() {
27+
exists(Compilation c |
28+
c.getAFileCompiled() = this.getFile() and
29+
result = c.getOutputAssembly()
30+
)
31+
}
2632

2733
/**
2834
* Gets a control flow node for this element. That is, a node in the

0 commit comments

Comments
 (0)