@@ -206,7 +206,7 @@ class TranslatedClassListInitialization extends TranslatedListInitialization {
206206 fieldInit = getTranslatedFieldInitialization ( expr , _) and
207207 fieldInit .getOrder ( ) = ord
208208 |
209- fieldInit order by ord , fieldInit .getRepetitionIndex ( )
209+ fieldInit order by ord , fieldInit .getPosition ( )
210210 )
211211 }
212212}
@@ -224,7 +224,7 @@ class TranslatedArrayListInitialization extends TranslatedListInitialization {
224224 rank [ id + 1 ] ( TranslatedElementInitialization init |
225225 init .getInitList ( ) = expr
226226 |
227- init order by init .getElementIndex ( ) , init .getRepetitionIndex ( )
227+ init order by init .getElementIndex ( ) , init .getPosition ( )
228228 )
229229 }
230230}
@@ -525,11 +525,8 @@ abstract class TranslatedFieldInitialization extends TranslatedElement {
525525
526526 final Field getField ( ) { result = field }
527527
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 }
533530}
534531
535532/**
@@ -540,10 +537,10 @@ class TranslatedExplicitFieldInitialization extends TranslatedFieldInitializatio
540537 InitializationContext , TTranslatedExplicitFieldInitialization
541538{
542539 Expr expr ;
543- int repitition ;
540+ int position ;
544541
545542 TranslatedExplicitFieldInitialization ( ) {
546- this = TTranslatedExplicitFieldInitialization ( ast , field , expr , repitition )
543+ this = TTranslatedExplicitFieldInitialization ( ast , field , expr , position )
547544 }
548545
549546 override Instruction getTargetAddress ( ) { result = getInstruction ( getFieldAddressTag ( ) ) }
@@ -566,7 +563,7 @@ class TranslatedExplicitFieldInitialization extends TranslatedFieldInitializatio
566563 result = getTranslatedInitialization ( expr )
567564 }
568565
569- override int getRepetitionIndex ( ) { result = repitition }
566+ override int getPosition ( ) { result = position }
570567}
571568
572569private string getZeroValue ( Type type ) {
@@ -700,7 +697,7 @@ abstract class TranslatedElementInitialization extends TranslatedElement {
700697
701698 abstract int getElementIndex ( ) ;
702699
703- int getRepetitionIndex ( ) { result = 0 }
700+ int getPosition ( ) { result = - 1 }
704701
705702 final InstructionTag getElementAddressTag ( ) { result = InitializerElementAddressTag ( ) }
706703
@@ -719,10 +716,10 @@ class TranslatedExplicitElementInitialization extends TranslatedElementInitializ
719716 TTranslatedExplicitElementInitialization , InitializationContext
720717{
721718 int elementIndex ;
722- int repetition ;
719+ int position ;
723720
724721 TranslatedExplicitElementInitialization ( ) {
725- this = TTranslatedExplicitElementInitialization ( initList , elementIndex , repetition )
722+ this = TTranslatedExplicitElementInitialization ( initList , elementIndex , position )
726723 }
727724
728725 override Instruction getTargetAddress ( ) { result = getInstruction ( getElementAddressTag ( ) ) }
@@ -745,12 +742,12 @@ class TranslatedExplicitElementInitialization extends TranslatedElementInitializ
745742
746743 override int getElementIndex ( ) { result = elementIndex }
747744
748- override int getRepetitionIndex ( ) { result = repetition }
745+ override int getPosition ( ) { result = position }
749746
750747 TranslatedInitialization getInitialization ( ) {
751748 result =
752749 getTranslatedInitialization ( initList
753- .getElementExpr ( elementIndex , repetition )
750+ .getElementExpr ( elementIndex , position )
754751 .getFullyConverted ( ) )
755752 }
756753}
0 commit comments