add a new LoadStoreStep as a StepSummary for TypeTracking

This commit is contained in:
Erik Krogh Kristensen 2020-03-25 20:00:34 +01:00
Родитель e7fd97e72b
Коммит 9a78d38df0
2 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -44,7 +44,7 @@ private newtype TTypeTracker = MkTypeTracker(Boolean hasCall, OptionalPropertyNa
*/
class TypeTracker extends TTypeTracker {
Boolean hasCall;
string prop;
OptionalPropertyName prop;
TypeTracker() { this = MkTypeTracker(hasCall, prop) }
@ -53,6 +53,8 @@ class TypeTracker extends TTypeTracker {
TypeTracker append(StepSummary step) {
step = LevelStep() and result = this
or
step = LoadStoreStep(prop) and result = this
or
step = CallStep() and result = MkTypeTracker(true, prop)
or
step = ReturnStep() and hasCall = false and result = this
@ -211,6 +213,8 @@ class TypeBackTracker extends TTypeBackTracker {
TypeBackTracker prepend(StepSummary step) {
step = LevelStep() and result = this
or
step = LoadStoreStep(prop) and result = this
or
step = CallStep() and hasReturn = false and result = this
or
step = ReturnStep() and result = MkTypeBackTracker(true, prop)

Просмотреть файл

@ -34,7 +34,8 @@ newtype TStepSummary =
CallStep() or
ReturnStep() or
StoreStep(PropertyName prop) or
LoadStep(PropertyName prop)
LoadStep(PropertyName prop) or
LoadStoreStep(PropertyName prop)
/**
* INTERNAL: Use `TypeTracker` or `TypeBackTracker` instead.
@ -53,6 +54,8 @@ class StepSummary extends TStepSummary {
exists(string prop | this = StoreStep(prop) | result = "store " + prop)
or
exists(string prop | this = LoadStep(prop) | result = "load " + prop)
or
exists(string prop | this = LoadStoreStep(prop) | result = "in " + prop)
}
}