add Str.endsWith

This commit is contained in:
Folkert 2020-12-03 19:16:50 +01:00
parent e8583a72fb
commit 22d798b7c7
12 changed files with 121 additions and 15 deletions

View file

@ -4,7 +4,8 @@ use crate::llvm::build_list::{
list_reverse, list_set, list_single, list_sum, list_walk, list_walk_backwards,
};
use crate::llvm::build_str::{
str_concat, str_count_graphemes, str_len, str_split, str_starts_with, CHAR_LAYOUT,
str_concat, str_count_graphemes, str_ends_with, str_len, str_split, str_starts_with,
CHAR_LAYOUT,
};
use crate::llvm::compare::{build_eq, build_neq};
use crate::llvm::convert::{
@ -2436,6 +2437,14 @@ fn run_low_level<'a, 'ctx, 'env>(
str_starts_with(env, inplace, scope, parent, args[0], args[1])
}
StrEndsWith => {
// Str.startsWith : Str, Str -> Bool
debug_assert_eq!(args.len(), 2);
let inplace = get_inplace_from_layout(layout);
str_ends_with(env, inplace, scope, parent, args[0], args[1])
}
StrSplit => {
// Str.split : Str, Str -> List Str
debug_assert_eq!(args.len(), 2);