Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
jianlingzhong committed Nov 5, 2024
1 parent 4131370 commit ed94dce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions compiler+runtime/src/cpp/jank/runtime/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ namespace jank::runtime
o);
}

object_ptr force(object_ptr const o) {
if (o->type == object_type::delay) {
object_ptr force(object_ptr const o)
{
if(o->type == object_type::delay)
{
return expect_object<obj::delay>(o)->deref();
}
return o;
Expand Down
16 changes: 9 additions & 7 deletions compiler+runtime/src/cpp/jank/runtime/obj/delay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ namespace jank::runtime
{
fmt::memory_buffer buff;
to_string(buff);
return native_persistent_string{buff.data(), buff.size()};
return native_persistent_string{ buff.data(), buff.size() };
}


void obj::delay::to_string(fmt::memory_buffer &buff) const
{
fmt::format_to(std::back_inserter(buff),
Expand All @@ -40,25 +39,28 @@ namespace jank::runtime

object_ptr obj::delay::deref()
{
std::lock_guard<std::mutex> const lock{mutex};
std::lock_guard<std::mutex> const lock{ mutex };
if(val != nullptr)
{
return val;
}

if (error != nullptr) {
if(error != nullptr)
{
throw error;
}

try {
try
{
val = dynamic_call(fn);
}
catch (std::exception const &e)
catch(std::exception const &e)
{
error = make_box(e.what());
throw;
}
catch (object_ptr const e) {
catch(object_ptr const e)
{
error = e;
throw;
}
Expand Down

0 comments on commit ed94dce

Please sign in to comment.