@@ -206,7 +206,7 @@ class TranslatedClassListInitialization extends TranslatedListInitialization {
206
206
fieldInit = getTranslatedFieldInitialization ( expr , _) and
207
207
fieldInit .getOrder ( ) = ord
208
208
|
209
- fieldInit order by ord , fieldInit .getRepetitionIndex ( )
209
+ fieldInit order by ord , fieldInit .getPosition ( )
210
210
)
211
211
}
212
212
}
@@ -224,7 +224,7 @@ class TranslatedArrayListInitialization extends TranslatedListInitialization {
224
224
rank [ id + 1 ] ( TranslatedElementInitialization init |
225
225
init .getInitList ( ) = expr
226
226
|
227
- init order by init .getElementIndex ( ) , init .getRepetitionIndex ( )
227
+ init order by init .getElementIndex ( ) , init .getPosition ( )
228
228
)
229
229
}
230
230
}
@@ -525,11 +525,8 @@ abstract class TranslatedFieldInitialization extends TranslatedElement {
525
525
526
526
final Field getField ( ) { result = field }
527
527
528
- /**
529
- * Gets the index of this initialization, if the field is mentioned
530
- * multiple times in the initializer.
531
- */
532
- int getRepetitionIndex ( ) { result = 0 }
528
+ /** Gets the position in the initializer list, or `-1` if the initialization is implicit. */
529
+ int getPosition ( ) { result = - 1 }
533
530
}
534
531
535
532
/**
@@ -540,10 +537,10 @@ class TranslatedExplicitFieldInitialization extends TranslatedFieldInitializatio
540
537
InitializationContext , TTranslatedExplicitFieldInitialization
541
538
{
542
539
Expr expr ;
543
- int repitition ;
540
+ int position ;
544
541
545
542
TranslatedExplicitFieldInitialization ( ) {
546
- this = TTranslatedExplicitFieldInitialization ( ast , field , expr , repitition )
543
+ this = TTranslatedExplicitFieldInitialization ( ast , field , expr , position )
547
544
}
548
545
549
546
override Instruction getTargetAddress ( ) { result = getInstruction ( getFieldAddressTag ( ) ) }
@@ -566,7 +563,7 @@ class TranslatedExplicitFieldInitialization extends TranslatedFieldInitializatio
566
563
result = getTranslatedInitialization ( expr )
567
564
}
568
565
569
- override int getRepetitionIndex ( ) { result = repitition }
566
+ override int getPosition ( ) { result = position }
570
567
}
571
568
572
569
private string getZeroValue ( Type type ) {
@@ -700,7 +697,7 @@ abstract class TranslatedElementInitialization extends TranslatedElement {
700
697
701
698
abstract int getElementIndex ( ) ;
702
699
703
- int getRepetitionIndex ( ) { result = 0 }
700
+ int getPosition ( ) { result = - 1 }
704
701
705
702
final InstructionTag getElementAddressTag ( ) { result = InitializerElementAddressTag ( ) }
706
703
@@ -719,10 +716,10 @@ class TranslatedExplicitElementInitialization extends TranslatedElementInitializ
719
716
TTranslatedExplicitElementInitialization , InitializationContext
720
717
{
721
718
int elementIndex ;
722
- int repetition ;
719
+ int position ;
723
720
724
721
TranslatedExplicitElementInitialization ( ) {
725
- this = TTranslatedExplicitElementInitialization ( initList , elementIndex , repetition )
722
+ this = TTranslatedExplicitElementInitialization ( initList , elementIndex , position )
726
723
}
727
724
728
725
override Instruction getTargetAddress ( ) { result = getInstruction ( getElementAddressTag ( ) ) }
@@ -745,12 +742,12 @@ class TranslatedExplicitElementInitialization extends TranslatedElementInitializ
745
742
746
743
override int getElementIndex ( ) { result = elementIndex }
747
744
748
- override int getRepetitionIndex ( ) { result = repetition }
745
+ override int getPosition ( ) { result = position }
749
746
750
747
TranslatedInitialization getInitialization ( ) {
751
748
result =
752
749
getTranslatedInitialization ( initList
753
- .getElementExpr ( elementIndex , repetition )
750
+ .getElementExpr ( elementIndex , position )
754
751
.getFullyConverted ( ) )
755
752
}
756
753
}
0 commit comments