Skip to content

Commit e582920

Browse files
committed
Go: Implement ContentSet
1 parent 282699e commit e582920

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

go/ql/lib/semmle/go/dataflow/internal/DataFlowUtil.qll

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,34 @@ class SyntheticFieldContent extends Content, TSyntheticFieldContent {
230230
override string toString() { result = s.toString() }
231231
}
232232

233+
/**
234+
* An entity that represents a set of `Content`s.
235+
*
236+
* The set may be interpreted differently depending on whether it is
237+
* stored into (`getAStoreContent`) or read from (`getAReadContent`).
238+
*/
239+
class ContentSet instanceof Content {
240+
/** Gets a content that may be stored into when storing into this set. */
241+
Content getAStoreContent() { result = this }
242+
243+
/** Gets a content that may be read from when reading from this set. */
244+
Content getAReadContent() { result = this }
245+
246+
/** Gets a textual representation of this content set. */
247+
string toString() { result = super.toString() }
248+
249+
/**
250+
* Holds if this element is at the specified location.
251+
* The location spans column `startcolumn` of line `startline` to
252+
* column `endcolumn` of line `endline` in file `filepath`.
253+
* For more information, see
254+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
255+
*/
256+
predicate hasLocationInfo(string path, int sl, int sc, int el, int ec) {
257+
super.hasLocationInfo(path, sl, sc, el, ec)
258+
}
259+
}
260+
233261
/**
234262
* Holds if the guard `g` validates the expression `e` upon evaluating to `branch`.
235263
*

0 commit comments

Comments
 (0)