Rename Str.toBytes to Str.toUtf8

This commit is contained in:
Richard Feldman 2021-08-07 21:57:48 -04:00
parent 23e11ca946
commit 2a616103c6
16 changed files with 33 additions and 33 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_join_with, str_number_of_bytes, str_split, str_starts_with,
str_starts_with_code_point, str_to_bytes,
str_starts_with_code_point, str_to_utf8,
};
use crate::llvm::compare::{generic_eq, generic_neq};
use crate::llvm::convert::{
@ -4444,7 +4444,7 @@ fn run_low_level<'a, 'ctx, 'env>(
str_from_utf8(env, parent, original_wrapper)
}
StrToBytes => {
StrToUtf8 => {
// Str.fromInt : Str -> List U8
debug_assert_eq!(args.len(), 1);
@ -4452,7 +4452,7 @@ fn run_low_level<'a, 'ctx, 'env>(
// we just implement it here to subvert the type system
let string = load_symbol(scope, &args[0]);
str_to_bytes(env, string.into_struct_value())
str_to_utf8(env, string.into_struct_value())
}
StrSplit => {
// Str.split : Str, Str -> List Str

View file

@ -235,8 +235,8 @@ pub fn str_from_int<'a, 'ctx, 'env>(
call_bitcode_fn(env, &[int], bitcode::STR_FROM_INT)
}
/// Str.toBytes : Str -> List U8
pub fn str_to_bytes<'a, 'ctx, 'env>(
/// Str.toUtf8 : Str -> List U8
pub fn str_to_utf8<'a, 'ctx, 'env>(
env: &Env<'a, 'ctx, 'env>,
original_wrapper: StructValue<'ctx>,
) -> BasicValueEnum<'ctx> {
@ -244,10 +244,10 @@ pub fn str_to_bytes<'a, 'ctx, 'env>(
env.builder,
original_wrapper.into(),
env.context.i128_type().into(),
"to_bytes",
"to_utf8",
);
call_bitcode_fn_returns_list(env, &[string], bitcode::STR_TO_BYTES)
call_bitcode_fn_returns_list(env, &[string], bitcode::STR_TO_UTF8)
}
/// Str.fromUtf8 : List U8 -> { a : Bool, b : Str, c : Nat, d : I8 }