@@ -755,26 +755,25 @@ public String translate(String self, PDict table,
755
755
return new String (translatedChars );
756
756
}
757
757
758
- private static String translateFromByteTable (String text , Object table , BytesNodes . ToBytesNode toBytesNode ) {
758
+ private static String translateFromByteTable (String text , byte [] table ) {
759
759
byte [] translatedChars = text .getBytes ();
760
- byte [] byteTable = toBytesNode .execute (table );
761
760
for (int i = 0 ; i < translatedChars .length ; i ++) {
762
761
byte original = translatedChars [i ];
763
- translatedChars [i ] = byteTable [original ];
762
+ translatedChars [i ] = table [original ];
764
763
}
765
764
return new String (translatedChars );
766
765
}
767
766
768
767
@ Specialization
769
768
public String translate (String self , PIBytesLike table ,
770
769
@ Cached ("create()" ) BytesNodes .ToBytesNode getBytesNode ) {
771
- return translateFromByteTable (self , table , getBytesNode );
770
+ return translateFromByteTable (self , getBytesNode . execute ( table ) );
772
771
}
773
772
774
773
@ Specialization
775
774
public String translate (String self , PMemoryView table ,
776
775
@ Cached ("create()" ) BytesNodes .ToBytesNode getBytesNode ) {
777
- return translateFromByteTable (self , table , getBytesNode );
776
+ return translateFromByteTable (self , getBytesNode . execute ( table ) );
778
777
}
779
778
780
779
}
0 commit comments