@@ -818,7 +818,7 @@ private module AssignOperationDesugar {
818818 i in [ 0 .. sao .getNumberOfArguments ( ) ]
819819 or
820820 parent = setter and
821- i = opAssignIndex + 1 and
821+ i = opAssignIndex and
822822 child =
823823 SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( sao , opAssignIndex ) ) )
824824 )
@@ -975,7 +975,7 @@ private module DestructuredAssignDesugar {
975975
976976 pragma [ nomagic]
977977 private predicate destructuredAssignSynthesis ( AstNode parent , int i , Child child ) {
978- exists ( DestructuredAssignExpr tae |
978+ exists ( DestructuredAssignExpr tae , int total | total = tae . getNumberOfElements ( ) |
979979 parent = tae and
980980 i = - 1 and
981981 child = SynthChild ( StmtSequenceKind ( ) )
@@ -998,15 +998,13 @@ private module DestructuredAssignDesugar {
998998 )
999999 or
10001000 parent = seq and
1001- i = tae . getNumberOfElements ( ) and
1001+ i = total and
10021002 child = SynthChild ( AssignExprKind ( ) )
10031003 or
1004- exists ( AstNode assign | assign = TAssignExprSynth ( seq , tae . getNumberOfElements ( ) ) |
1004+ exists ( AstNode assign | assign = TAssignExprSynth ( seq , total ) |
10051005 parent = assign and
10061006 i = 0 and
1007- child =
1008- SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( tae ,
1009- tae .getNumberOfElements ( ) ) ) )
1007+ child = SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( tae , total ) ) )
10101008 or
10111009 parent = assign and
10121010 i = 1 and
@@ -1022,12 +1020,10 @@ private module DestructuredAssignDesugar {
10221020 restIndex = tae .getRestIndexOrNumberOfElements ( )
10231021 |
10241022 parent = seq and
1025- i = j + 1 + tae . getNumberOfElements ( ) and
1023+ i = j + 1 + total and
10261024 child = SynthChild ( AssignExprKind ( ) )
10271025 or
1028- exists ( AstNode assign |
1029- assign = TAssignExprSynth ( seq , j + 1 + tae .getNumberOfElements ( ) )
1030- |
1026+ exists ( AstNode assign | assign = TAssignExprSynth ( seq , j + 1 + total ) |
10311027 exists ( LhsWithReceiver mc | mc = elem |
10321028 parent = assign and
10331029 i = 0 and
@@ -1063,9 +1059,7 @@ private module DestructuredAssignDesugar {
10631059 or
10641060 parent = TMethodCallSynth ( assign , 1 , _, _, _) and
10651061 i = 0 and
1066- child =
1067- SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( tae ,
1068- tae .getNumberOfElements ( ) ) ) )
1062+ child = SynthChild ( LocalVariableAccessSynthKind ( TLocalVariableSynth ( tae , total ) ) )
10691063 or
10701064 j < restIndex and
10711065 parent = TMethodCallSynth ( assign , 1 , _, _, _) and
@@ -1086,14 +1080,14 @@ private module DestructuredAssignDesugar {
10861080 child = SynthChild ( IntegerLiteralKind ( j ) )
10871081 or
10881082 i = 1 and
1089- child = SynthChild ( IntegerLiteralKind ( restIndex - tae . getNumberOfElements ( ) ) )
1083+ child = SynthChild ( IntegerLiteralKind ( restIndex - total ) )
10901084 )
10911085 )
10921086 or
10931087 j > restIndex and
10941088 parent = TMethodCallSynth ( assign , 1 , _, _, _) and
10951089 i = 1 and
1096- child = SynthChild ( IntegerLiteralKind ( j - tae . getNumberOfElements ( ) ) )
1090+ child = SynthChild ( IntegerLiteralKind ( j - total ) )
10971091 )
10981092 )
10991093 )
@@ -1284,10 +1278,10 @@ private module ForLoopDesugar {
12841278 child = childRef ( for .getValue ( ) ) // value is the Enumerable
12851279 or
12861280 parent = eachCall and
1287- i = - 2 and
1281+ i = 1 and
12881282 child = SynthChild ( BraceBlockKind ( ) )
12891283 or
1290- exists ( Block block | block = TBraceBlockSynth ( eachCall , - 2 ) |
1284+ exists ( Block block | block = TBraceBlockSynth ( eachCall , 1 ) |
12911285 // block params
12921286 parent = block and
12931287 i = 0 and
@@ -1534,14 +1528,13 @@ private module SafeNavigationCallDesugar {
15341528 i = 1
15351529 )
15361530 or
1537- parent = TMethodCallSynth ( ifExpr , 2 , _, _, _) and
1538- (
1531+ exists ( int arity | parent = TMethodCallSynth ( ifExpr , 2 , _, _, arity ) |
15391532 i = 0 and
15401533 child = SynthChild ( local )
15411534 or
15421535 child = childRef ( call .getArgumentImpl ( i - 1 ) )
15431536 or
1544- child = childRef ( call .getBlockImpl ( ) ) and i = - 2
1537+ child = childRef ( call .getBlockImpl ( ) ) and i = arity + 1
15451538 )
15461539 )
15471540 )
0 commit comments