JS: Avoid lots of unhelpful magic

This commit is contained in:
Asger Feldthaus
2020-04-27 23:28:35 +01:00
parent a8283593a9
commit 9b014c36df
4 changed files with 4 additions and 0 deletions

View File

@@ -586,6 +586,7 @@ module DataFlow {
* This predicate is undefined for spread properties, accessor
* properties, and most uses of `Object.defineProperty`.
*/
pragma[nomagic]
abstract Node getRhs();
/**

View File

@@ -156,6 +156,7 @@ class InvokeNode extends DataFlow::SourceNode {
* Holds if the `i`th argument of this invocation is an object literal whose property
* `name` is set to `result`.
*/
pragma[nomagic]
DataFlow::ValueNode getOptionArgument(int i, string name) {
getOptionsArgument(i).hasPropertyWrite(name, result)
}

View File

@@ -70,6 +70,7 @@ class SourceNode extends DataFlow::Node {
* Holds if there is an assignment to property `propName` on this node,
* and the right hand side of the assignment is `rhs`.
*/
pragma[nomagic]
predicate hasPropertyWrite(string propName, DataFlow::Node rhs) {
rhs = getAPropertyWrite(propName).getRhs()
}

View File

@@ -461,6 +461,7 @@ class ComponentDirective extends CustomDirective, MkCustomComponent {
override DataFlow::Node getDefinition() { result = comp }
pragma[nomagic]
override DataFlow::ValueNode getMemberInit(string name) {
comp.getConfig().hasPropertyWrite(name, result)
}