File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -161,7 +161,7 @@ where
161161 // exclude results from non-value definitions from `Object.defineProperty`
162162 (
163163 assign1 instanceof CallToObjectDefineProperty implies
164- assign1 .( CallToObjectDefineProperty ) .getAPropertyAttribute ( ) . getPropertyName ( ) = "value"
164+ assign1 .( CallToObjectDefineProperty ) .hasPropertyAttributeWrite ( "value" , _ )
165165 )
166166select assign1 .getWriteNode ( ) ,
167167 "This write to property '" + name + "' is useless, since $@ always overrides it." ,
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ predicate isGetterProperty(string name) {
3939 exists ( CallToObjectDefineProperty defProp |
4040 name = defProp .getPropertyName ( ) |
4141 // ... where `descriptor` defines a getter
42- defProp .getAPropertyAttribute ( ) . getPropertyName ( ) = "get" or
42+ defProp .hasPropertyAttributeWrite ( "get" , _ ) or
4343 // ... where `descriptor` may define a getter
4444 exists ( DataFlow:: SourceNode descriptor |
4545 descriptor .flowsTo ( defProp .getPropertyDescriptor ( ) ) |
Original file line number Diff line number Diff line change @@ -22,14 +22,17 @@ class CallToObjectDefineProperty extends DataFlow::MethodCallNode {
2222 /** Gets the data flow node denoting the descriptor of the property being defined. */
2323 DataFlow:: Node getPropertyDescriptor ( ) { result = getArgument ( 2 ) }
2424
25- /** Gets a data flow node defining a descriptor attribute of the property being defined. */
26- DataFlow:: PropWrite getAPropertyAttribute ( ) {
27- exists ( DataFlow:: SourceNode descriptor |
25+ /**
26+ * Holds if there is an assignment to property `name` to the
27+ * attributes object on this node, and the right hand side of the
28+ * assignment is `rhs`.
29+ */
30+ predicate hasPropertyAttributeWrite ( string name , DataFlow:: Node rhs ) {
31+ exists ( DataFlow:: SourceNode descriptor |
2832 descriptor .flowsTo ( getPropertyDescriptor ( ) ) and
29- result = descriptor .getAPropertyWrite ( )
33+ descriptor .hasPropertyWrite ( name , rhs )
3034 )
3135 }
32-
3336}
3437
3538/**
You can’t perform that action at this time.
0 commit comments