Skip to content

Commit 74b2a2c

Browse files
committed
Improve style of interpretField
1 parent 5cf0243 commit 74b2a2c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

java/ql/src/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,22 +70,21 @@ predicate summaryElement(DataFlowCallable c, string input, string output, string
7070
)
7171
}
7272

73-
bindingset[name]
74-
private FieldContent interpretField(string name) {
75-
exists(string splitRegex, string package, string className, string fieldName |
76-
splitRegex = "^(.*)\\.([^.]+)\\.([^.]+)$" and
77-
package = name.regexpCapture(splitRegex, 1) and
78-
className = name.regexpCapture(splitRegex, 2) and
79-
fieldName = name.regexpCapture(splitRegex, 3)
80-
|
73+
private FieldContent parseField(string c) {
74+
External::specSplit(_, c, _) and
75+
exists(string fieldRegex, string package, string className, string fieldName |
76+
fieldRegex = "^Field (.*)\\.([^.]+)\\.([^.]+)$" and
77+
package = c.regexpCapture(fieldRegex, 1) and
78+
className = c.regexpCapture(fieldRegex, 2) and
79+
fieldName = c.regexpCapture(fieldRegex, 3) and
8180
result.getField().hasQualifiedName(package, className, fieldName)
8281
)
8382
}
8483

8584
/** Gets the summary component for specification component `c`, if any. */
8685
bindingset[c]
8786
SummaryComponent interpretComponentSpecific(string c) {
88-
c.matches("Field %") and result = SummaryComponent::content(interpretField(c.splitAt(" ", 1)))
87+
result = SummaryComponent::content(parseField(c))
8988
or
9089
c = "ArrayElement" and result = SummaryComponent::content(any(ArrayContent c0))
9190
or

0 commit comments

Comments
 (0)