JS: add PropWrite instance for parameter fields

This commit is contained in:
Asger F 2019-01-28 15:17:28 +00:00
Родитель dacde5da12
Коммит 7a4af4af6d
1 изменённых файлов: 19 добавлений и 0 удалений

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

@ -512,6 +512,25 @@ module DataFlow {
override ControlFlowNode getWriteNode() { result = prop }
}
/**
* A field induced by an initializing constructor parameter, seen as a property write (TypeScript only).
*/
private class ParameterFieldAsPropWrite extends PropWrite, PropNode {
override ParameterField prop;
override Node getBase() {
result = thisNode(prop.getDeclaringClass().getConstructor().getBody())
}
override Expr getPropertyNameExpr() { result = prop.getNameExpr() }
override string getPropertyName() { result = prop.getName() }
override Node getRhs() { result = parameterNode(prop.getParameter()) }
override ControlFlowNode getWriteNode() { result = prop.getParameter() }
}
/**
* A data flow node that reads an object property.
*/