@@ -469,12 +469,9 @@ private predicate overridesOrImplementsSourceDecl(Property p1, Property p2) {
469469private predicate fieldOrPropertyRead ( Expr e1 , Content c , FieldOrPropertyRead e2 ) {
470470 e1 = e2 .getQualifier ( ) and
471471 exists ( FieldOrProperty ret | c = ret .getContent ( ) |
472- ret .isFieldLike ( ) and
473472 ret = e2 .getTarget ( )
474473 or
475- exists ( ContentList cl , Property target |
476- FlowSummaryImpl:: Private:: summary ( _, _, _, _, cl , _) and
477- cl .contains ( ret .getContent ( ) ) and
474+ exists ( Property target |
478475 target .getGetter ( ) = e2 .( PropertyCall ) .getARuntimeTarget ( ) and
479476 overridesOrImplementsSourceDecl ( target , ret )
480477 )
@@ -640,6 +637,10 @@ private module Cached {
640637 output = SummaryOutput:: delegate ( delegateIndex , parameterIndex )
641638 )
642639 } or
640+ TSummaryJumpNode ( SummarizedCallable c , SummarizableCallable target , ReturnKind rk ) {
641+ FlowSummaryImpl:: Private:: summary ( c , _, _,
642+ FlowSummarySpecific:: Private:: TJumpSummaryOutput ( target , rk ) , _, _)
643+ } or
643644 TParamsArgumentNode ( ControlFlow:: Node callCfn ) {
644645 callCfn = any ( Call c | isParamsArg ( c , _, _) ) .getAControlFlowNode ( )
645646 }
@@ -685,8 +686,19 @@ private module Cached {
685686 * taken into account.
686687 */
687688 cached
688- predicate jumpStepImpl ( ExprNode pred , ExprNode succ ) {
689+ predicate jumpStepImpl ( Node pred , Node succ ) {
689690 pred .( NonLocalJumpNode ) .getAJumpSuccessor ( true ) = succ
691+ or
692+ exists ( FieldOrProperty fl , FieldOrPropertyRead flr |
693+ fl .isStatic ( ) and
694+ fl .isFieldLike ( ) and
695+ fl .getAnAssignedValue ( ) = pred .asExpr ( ) and
696+ fl .getAnAccess ( ) = flr and
697+ flr = succ .asExpr ( ) and
698+ flr .hasNonlocalValue ( )
699+ )
700+ or
701+ succ = pred .( SummaryJumpNode ) .getAJumpTarget ( )
690702 }
691703
692704 cached
@@ -1613,6 +1625,28 @@ private class SummaryInternalNode extends SummaryNodeImpl, TSummaryInternalNode
16131625 override string toStringImpl ( ) { result = "[summary] " + state + " in " + c }
16141626}
16151627
1628+ /** A data-flow node used to model flow summaries with jumps. */
1629+ private class SummaryJumpNode extends SummaryNodeImpl , TSummaryJumpNode {
1630+ private SummarizedCallable c ;
1631+ private SummarizableCallable target ;
1632+ private ReturnKind rk ;
1633+
1634+ SummaryJumpNode ( ) { this = TSummaryJumpNode ( c , target , rk ) }
1635+
1636+ /** Gets a jump target of this node. */
1637+ OutNode getAJumpTarget ( ) { target = viableCallable ( result .getCall ( rk ) ) }
1638+
1639+ override Callable getEnclosingCallableImpl ( ) { result = c }
1640+
1641+ override DotNet:: Type getTypeImpl ( ) { result = target .getReturnType ( ) }
1642+
1643+ override ControlFlow:: Node getControlFlowNodeImpl ( ) { none ( ) }
1644+
1645+ override Location getLocationImpl ( ) { result = c .getLocation ( ) }
1646+
1647+ override string toStringImpl ( ) { result = "[summary] jump to " + target }
1648+ }
1649+
16161650/** A field or a property. */
16171651class FieldOrProperty extends Assignable , Modifiable {
16181652 FieldOrProperty ( ) {
@@ -1669,26 +1703,6 @@ private class FieldOrPropertyRead extends FieldOrPropertyAccess, AssignableRead
16691703 }
16701704}
16711705
1672- /** A write to a static field/property. */
1673- private class StaticFieldLikeJumpNode extends NonLocalJumpNode , ExprNode {
1674- FieldOrProperty fl ;
1675- FieldOrPropertyRead flr ;
1676- ExprNode succ ;
1677-
1678- StaticFieldLikeJumpNode ( ) {
1679- fl .isStatic ( ) and
1680- fl .isFieldLike ( ) and
1681- fl .getAnAssignedValue ( ) = this .getExpr ( ) and
1682- fl .getAnAccess ( ) = flr and
1683- flr = succ .getExpr ( ) and
1684- flr .hasNonlocalValue ( )
1685- }
1686-
1687- override ExprNode getAJumpSuccessor ( boolean preservesValue ) {
1688- result = succ and preservesValue = true
1689- }
1690- }
1691-
16921706predicate jumpStep = jumpStepImpl / 2 ;
16931707
16941708private class StoreStepConfiguration extends ControlFlowReachabilityConfiguration {
0 commit comments