Skip to content

Commit 1706367

Browse files
committed
Document DataFlowCallable
1 parent 9f4b77e commit 1706367

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,20 +242,44 @@ private newtype TDataFlowCallable =
242242
TSummarizedCallable(FlowSummary::SummarizedCallable c)
243243

244244
class DataFlowCallable extends TDataFlowCallable {
245+
/**
246+
* Gets the `Callable` corresponding to this `DataFlowCallable`, if any.
247+
*/
245248
Callable asCallable() { this = TCallable(result) }
246249

250+
/**
251+
* Gets the `File` whose root scope corresponds to this `DataFlowCallable`, if any.
252+
*/
247253
File asFileScope() { this = TFileScope(result) }
248254

255+
/**
256+
* Gets the `SummarizedCallable` corresponding to this `DataFlowCallable`, if any.
257+
*/
249258
FlowSummary::SummarizedCallable asSummarizedCallable() { this = TSummarizedCallable(result) }
250259

260+
/**
261+
* Gets the type of this callable.
262+
*
263+
* If this is a `File` root scope, this has no value.
264+
*/
251265
SignatureType getType() { result = [this.asCallable(), this.asSummarizedCallable()].getType() }
252266

267+
/**
268+
* Gets a string representation of this callable.
269+
*/
253270
string toString() {
254271
result = this.asCallable().toString() or
255272
result = "File scope: " + this.asFileScope().toString() or
256273
result = "Summary: " + this.asSummarizedCallable().toString()
257274
}
258275

276+
/**
277+
* Holds if this callable is at the specified location.
278+
* The location spans column `startcolumn` of line `startline` to
279+
* column `endcolumn` of line `endline` in file `filepath`.
280+
* For more information, see
281+
* [Locations](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/).
282+
*/
259283
predicate hasLocationInfo(
260284
string filepath, int startline, int startcolumn, int endline, int endcolumn
261285
) {

0 commit comments

Comments
 (0)