Skip to content

Commit f9b906d

Browse files
committed
C#: Update uses of RequiredSummaryComponentStack
1 parent cba7331 commit f9b906d

File tree

2 files changed

+11
-21
lines changed

2 files changed

+11
-21
lines changed

csharp/ql/lib/semmle/code/csharp/dataflow/FlowSummary.qll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,11 @@ private class SummarizedCallableDefaultClearsContent extends Impl::Public::Summa
153153
class RequiredSummaryComponentStack = Impl::Public::RequiredSummaryComponentStack;
154154

155155
private class RecordConstructorFlowRequiredSummaryComponentStack extends RequiredSummaryComponentStack {
156-
private SummaryComponent head;
157-
158-
RecordConstructorFlowRequiredSummaryComponentStack() {
156+
override predicate required(SummaryComponent head, SummaryComponentStack tail) {
159157
exists(Property p |
160158
recordConstructorFlow(_, _, p) and
161159
head = SummaryComponent::property(p) and
162-
this = SummaryComponentStack::return()
160+
tail = SummaryComponentStack::return()
163161
)
164162
}
165-
166-
override predicate required(SummaryComponent c) { c = head }
167163
}

csharp/ql/lib/semmle/code/csharp/frameworks/EntityFramework.qll

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,10 @@ module EntityFramework {
9191
abstract class EFSummarizedCallable extends SummarizedCallable { }
9292

9393
private class DbSetAddOrUpdateRequiredSummaryComponentStack extends RequiredSummaryComponentStack {
94-
private SummaryComponent head;
95-
96-
DbSetAddOrUpdateRequiredSummaryComponentStack() {
97-
this = SummaryComponentStack::argument([-1, 0]) and
98-
head = SummaryComponent::element()
94+
override predicate required(SummaryComponent head, SummaryComponentStack tail) {
95+
head = SummaryComponent::element() and
96+
tail = SummaryComponentStack::argument([-1, 0])
9997
}
100-
101-
override predicate required(SummaryComponent c) { c = head }
10298
}
10399

104100
private class DbSetAddOrUpdate extends EFSummarizedCallable {
@@ -462,14 +458,12 @@ module EntityFramework {
462458
}
463459

464460
private class DbContextSaveChangesRequiredSummaryComponentStack extends RequiredSummaryComponentStack {
465-
private Content head;
466-
467-
DbContextSaveChangesRequiredSummaryComponentStack() {
468-
any(DbContextClass c).requiresComponentStackIn(head, _, this, _)
469-
or
470-
any(DbContextClass c).requiresComponentStackOut(head, _, this, _)
461+
override predicate required(SummaryComponent head, SummaryComponentStack tail) {
462+
exists(Content c | head = SummaryComponent::content(c) |
463+
any(DbContextClass cls).requiresComponentStackIn(c, _, tail, _)
464+
or
465+
any(DbContextClass cls).requiresComponentStackOut(c, _, tail, _)
466+
)
471467
}
472-
473-
override predicate required(SummaryComponent c) { c = SummaryComponent::content(head) }
474468
}
475469
}

0 commit comments

Comments
 (0)