From 02d4d56f35d88e998cf0ba237df562118d2e5619 Mon Sep 17 00:00:00 2001 From: kayomn Date: Wed, 22 Feb 2023 21:03:24 +0000 Subject: [PATCH] Rename kym::value::as_* functions to kym::value::to_* --- source/kym.cpp | 2 +- source/runtime.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/kym.cpp b/source/kym.cpp index ed4e1d0..faec578 100644 --- a/source/kym.cpp +++ b/source/kym.cpp @@ -51,7 +51,7 @@ export namespace kym { this->type = value_type::vector3; } - coral::optional as_integer() const { + coral::optional to_integer() const { if (this->type == value_type::integer) return (*reinterpret_cast(&this->data)); diff --git a/source/runtime.cpp b/source/runtime.cpp index c7e365d..095a5c1 100644 --- a/source/runtime.cpp +++ b/source/runtime.cpp @@ -39,7 +39,7 @@ extern "C" int main(int argc, char const * const * argv) { vm.with_object(vm.compile(script_source.as_slice().as_chars()), [&](kym::bound_object & script) { vm.with_object(script.call({}), [&](kym::bound_object & config) { - constexpr auto as_u16 = [](coral::i64 value) -> coral::optional { + constexpr auto to_u16 = [](coral::i64 value) -> coral::optional { if ((value >= 0) && (value <= coral::u16_max)) return static_cast(value); @@ -47,13 +47,13 @@ extern "C" int main(int argc, char const * const * argv) { }; coral::u16 const width{config.get_field("width"). - as_integer().map(as_u16).value_or(0)}; + to_integer().map(to_u16).value_or(0)}; if (width == 0) return system.log(app::log_level::error, "failed to decode `width` property of config"); coral::u16 const height{config.get_field("height"). - as_integer().map(as_u16).value_or(0)}; + to_integer().map(to_u16).value_or(0)}; if (height == 0) return system.log(app::log_level::error, "failed to decode `height` property of config");