Add Str.repeat builtin

This commit is contained in:
Kofi Gumbs 2021-09-29 17:32:42 -04:00
parent 0b02929a53
commit b32a42f05a
11 changed files with 109 additions and 14 deletions

View file

@ -15,7 +15,7 @@ use crate::llvm::build_list::{
};
use crate::llvm::build_str::{
empty_str, str_concat, str_count_graphemes, str_ends_with, str_from_float, str_from_int,
str_from_utf8, str_from_utf8_range, str_join_with, str_number_of_bytes, str_split,
str_from_utf8, str_from_utf8_range, str_join_with, str_number_of_bytes, str_repeat, str_split,
str_starts_with, str_starts_with_code_point, str_to_utf8,
};
use crate::llvm::compare::{generic_eq, generic_neq};
@ -4853,6 +4853,12 @@ fn run_low_level<'a, 'ctx, 'env>(
str_to_utf8(env, string.into_struct_value())
}
StrRepeat => {
// Str.repeat : Str, Nat -> Str
debug_assert_eq!(args.len(), 2);
str_repeat(env, scope, args[0], args[1])
}
StrSplit => {
// Str.split : Str, Str -> List Str
debug_assert_eq!(args.len(), 2);