Skip to content

Commit

Permalink
Updated slice method in jsInterpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeucelli committed Aug 7, 2024
1 parent d0dae2c commit 02900a0
Show file tree
Hide file tree
Showing 3 changed files with 12,857 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1124,10 +1124,10 @@ Object evalMethod() throws Exception {
}
case "slice" -> {
assertion(obj instanceof List<?>, "must be applied on a list");
assertion(argvals.size() == 1, "takes exactly one argument");
assertion(argvals.size() == 2, "takes exactly one argument");
assert obj != null;

return obj.toString().substring((Integer) argvals.get(0));
return obj.toString().substring((Integer) argvals.get(0), argvals.size() > 1 ? (int) argvals.get(1) : obj.toString().length());
}
case "splice" -> {
assertion(obj instanceof List<?>, "must be applied on a list");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ static Stream<String> fileNames() {
"bc657243-player_ias.vflset-en_US.txt",
"b22ef6e7-player_ias.vflset-en_US.txt",
"1f8742dc-player_ias.vflset-en_US.txt",
"20dfca59-player_ias.vflset-en_US.txt"
"20dfca59-player_ias.vflset-en_US.txt",
"b12cc44b-player_ias.vflset-en_US.txt"
);
}
private String readFileContent(String fileName) throws IOException {
Expand Down Expand Up @@ -106,6 +107,7 @@ private List<String> getNSigParams(String fileName) {
case "b22ef6e7-player_ias.vflset-en_US.txt" -> List.of("3imMGazkXNJnWK", "Ima", "70QzMb0nhneLLS6BN");
case "1f8742dc-player_ias.vflset-en_US.txt" -> List.of("wx4GPH8bp1v7A9", "rma", "70QzMb0nhneLLS6BN");
case "20dfca59-player_ias.vflset-en_US.txt" -> List.of("zmLIydxjzkWeBA9", "rma", "70QzMb0nhneLLS6BN");
case "b12cc44b-player_ias.vflset-en_US.txt" -> List.of("FnDBX5UEM1NHNyr", "Ema", "70QzMb0nhneLLS6BN");
default -> List.of("", "", "");
};
}
Expand Down Expand Up @@ -139,6 +141,7 @@ private List<String> getSigParams(String fileName) {
case "b22ef6e7-player_ias.vflset-en_US.txt" -> List.of("goDDREeR36Kj5wrO_NjqCHEmy6PANTGWF9GKnFEIC4P07ptGh54LI6biy39oUrq5ITnRI3mE0gJchXqWRWNIgIARw8JQ0qOG", "LPa", "AOq0QJ8wRAIgINWRWqXhcJg0Em3IRnTm5qrUo93yib6IL45hGtp70P4CIEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxTO");
case "1f8742dc-player_ias.vflset-en_US.txt" -> List.of("mQJ8wRAIgINW9WqXhcJg0E03IRnTm5qrUoA3yib6IL45hGtp70P4CIEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxTO", "HBa", "AOq0QJ8wRAIgINWRWqXhcJg0Em3IRnTm5qrUo93yib6IL45hGtp70P4CIEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxTO");
case "20dfca59-player_ias.vflset-en_US.txt" -> List.of("U0QJ8wRAIgINWRWqXhcJg0qm3IRnTm5qrEo93yib6IL45hGtp70P4CTEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxI", "EBa", "AOq0QJ8wRAIgINWRWqXhcJg0Em3IRnTm5qrUo93yib6IL45hGtp70P4CIEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxTO");
case "b12cc44b-player_ias.vflset-en_US.txt" -> List.of("EJ8wRAIgINWRWqXhcJg0Am3IRnTm5qrUo93yib6IL45hGtp70P4CQEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDoOU", "PBa", "AOq0QJ8wRAIgINWRWqXhcJg0Em3IRnTm5qrUo93yib6IL45hGtp70P4CIEFnKG9FWGINGP6ymEHCqjN_Orw5jK63ReERDDogUxTO");
default -> List.of("", "", "");
};

Expand Down
Loading

0 comments on commit 02900a0

Please sign in to comment.