mirror of
https://github.com/github/codeql.git
synced 2026-05-01 03:35:13 +02:00
autoformat
This commit is contained in:
@@ -145,17 +145,17 @@ module Promises {
|
||||
* The below is an example of a type-tracking predicate where the initial value is a promise:
|
||||
* ```
|
||||
* DataFlow::SourceNode myType(DataFlow::TypeTracker t) {
|
||||
* t.startInPromise() and
|
||||
* t.startInPromise() and
|
||||
* result = <the promise value> and
|
||||
* or
|
||||
* exists(DataFlow::TypeTracker t2 | result = myType(t2).track(t2, t))
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* The type-tracking predicate above will only end (`t = DataFlow::TypeTracker::end()`) after the tracked value has been
|
||||
*
|
||||
* The type-tracking predicate above will only end (`t = DataFlow::TypeTracker::end()`) after the tracked value has been
|
||||
* extracted from the promise.
|
||||
*
|
||||
* The `PromiseTypeTracking::promiseStep` predicate can be used instead of `SourceNode::track`
|
||||
*
|
||||
* The `PromiseTypeTracking::promiseStep` predicate can be used instead of `SourceNode::track`
|
||||
* to get type-tracking only for promise steps.
|
||||
*
|
||||
* Replace `t.startInPromise()` in the above example with `t.start()` to create a type-tracking predicate
|
||||
@@ -241,6 +241,7 @@ abstract private class PromiseFlowStep extends DataFlow::AdditionalFlowStep {
|
||||
*/
|
||||
private module PromiseFlow {
|
||||
private predicate valueProp = Promises::valueProp/0;
|
||||
|
||||
private predicate errorProp = Promises::errorProp/0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -230,8 +230,8 @@ class TypeTracker extends TTypeTracker {
|
||||
predicate start() { hasCall = false and prop = "" }
|
||||
|
||||
/**
|
||||
* Holds if this is the starting point of type tracking, and the value starts in the property named `propName`.
|
||||
* The type tracking only ends after the property has been loaded.
|
||||
* Holds if this is the starting point of type tracking, and the value starts in the property named `propName`.
|
||||
* The type tracking only ends after the property has been loaded.
|
||||
*/
|
||||
predicate startInProp(PropertyName propName) { hasCall = false and prop = propName }
|
||||
|
||||
@@ -239,9 +239,7 @@ class TypeTracker extends TTypeTracker {
|
||||
* Holds if this is the starting point of type tracking, and the initial value is a promise.
|
||||
* The type tracking only ends after the value has been extracted from the promise.
|
||||
*/
|
||||
predicate startInPromise() {
|
||||
startInProp(Promises::valueProp())
|
||||
}
|
||||
predicate startInPromise() { startInProp(Promises::valueProp()) }
|
||||
|
||||
/**
|
||||
* Holds if this is the starting point of type tracking
|
||||
|
||||
Reference in New Issue
Block a user