Skip to content

Commit 8e92633

Browse files
author
Max Schaefer
committed
JavaScript: Simplify a few newtypes and remove unused predicates.
1 parent 55394df commit 8e92633

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

javascript/ql/src/semmle/javascript/dataflow/TypeTracking.qll

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@ private import internal.FlowSteps
1414
*
1515
* Identical to `TPathSummary` except without flow labels.
1616
*/
17-
private newtype TStepSummary = MkStepSummary(boolean hasReturn, boolean hasCall) {
18-
(hasReturn = true or hasReturn = false) and
19-
(hasCall = true or hasCall = false)
20-
}
17+
private newtype TStepSummary = MkStepSummary(Boolean hasReturn, Boolean hasCall)
2118

2219
/**
2320
* INTERNAL: Use `TypeTracker` or `TypeBackTracker` instead.
@@ -37,27 +34,6 @@ class StepSummary extends TStepSummary {
3734
/** Indicates whether the path represented by this summary contains any call steps. */
3835
boolean hasCall() { result = hasCall }
3936

40-
/**
41-
* Gets the summary for the path obtained by appending `that` to `this`.
42-
*
43-
* Note that a path containing a `return` step cannot be appended to a path containing
44-
* a `call` step in order to maintain well-formedness.
45-
*/
46-
StepSummary append(StepSummary that) {
47-
exists(Boolean hasReturn2, Boolean hasCall2 |
48-
that = MkStepSummary(hasReturn2, hasCall2)
49-
|
50-
result = MkStepSummary(hasReturn.booleanOr(hasReturn2), hasCall.booleanOr(hasCall2)) and
51-
// avoid constructing invalid paths
52-
not (hasCall = true and hasReturn2 = true)
53-
)
54-
}
55-
56-
/**
57-
* Gets the summary for the path obtained by appending `this` to `that`.
58-
*/
59-
StepSummary prepend(StepSummary that) { result = that.append(this) }
60-
6137
/** Gets a textual representation of this path summary. */
6238
string toString() {
6339
exists(string withReturn, string withCall |
@@ -133,9 +109,7 @@ module StepSummary {
133109
}
134110
}
135111

136-
private newtype TTypeTracker = MkTypeTracker(boolean hasCall) {
137-
hasCall = true or hasCall = false
138-
}
112+
private newtype TTypeTracker = MkTypeTracker(Boolean hasCall)
139113

140114
/**
141115
* EXPERIMENTAL.
@@ -193,9 +167,7 @@ class TypeTracker extends TTypeTracker {
193167
}
194168
}
195169

196-
private newtype TTypeBackTracker = MkTypeBackTracker(boolean hasReturn) {
197-
hasReturn = true or hasReturn = false
198-
}
170+
private newtype TTypeBackTracker = MkTypeBackTracker(Boolean hasReturn)
199171

200172
/**
201173
* EXPERIMENTAL.

0 commit comments

Comments
 (0)