Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 89c387c + 4ef4ede commit 642ec38Copy full SHA for 642ec38
2 files changed
csharp/ql/lib/semmle/code/csharp/dataflow/internal/SsaImpl.qll
@@ -108,7 +108,11 @@ private module SourceVariableImpl {
108
*/
109
predicate isPlainFieldOrPropAccess(FieldOrPropAccess fpa, FieldOrProp fp, Callable c) {
110
fieldOrPropAccessInCallable(fpa, fp, c) and
111
- (ownFieldOrPropAccess(fpa) or fp.isStatic())
+ (
112
+ ownFieldOrPropAccess(fpa)
113
+ or
114
+ fp.isStatic() and not fp instanceof EnumConstant
115
+ )
116
}
117
118
/**
csharp/ql/test/library-tests/dataflow/ssa/Enum.cs
@@ -0,0 +1,14 @@
1
+enum E
2
+{
3
+ A
4
+}
5
+
6
+class EnumTest
7
8
+ void M()
9
+ {
10
+ // enums are modelled as fields; this test checks that we do not compute SSA for them
11
+ var e1 = E.A;
12
+ var e2 = E.A;
13
+ }
14
0 commit comments