فهرست منبع

LibJS: Surround the VM parameter of TRY_OR_THROW_OOM with parentheses

Depending on how this is invoked, the preprocessor may get confused when
pasting the VM parameter into this expression. For example, it trips up
on the JS REPL in cases such as:

    TRY_OR_THROW_OOM(*g_vm, ...);
Timothy Flynn 2 سال پیش
والد
کامیت
8f9659a549
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      Userland/Libraries/LibJS/Runtime/Completion.h

+ 1 - 1
Userland/Libraries/LibJS/Runtime/Completion.h

@@ -24,7 +24,7 @@ namespace JS {
             auto&& _temporary_result = (expression));                                                \
             auto&& _temporary_result = (expression));                                                \
         if (_temporary_result.is_error()) {                                                          \
         if (_temporary_result.is_error()) {                                                          \
             VERIFY(_temporary_result.error().code() == ENOMEM);                                      \
             VERIFY(_temporary_result.error().code() == ENOMEM);                                      \
-            return vm.throw_completion<JS::InternalError>(JS::ErrorType::OutOfMemory);               \
+            return (vm).throw_completion<JS::InternalError>(JS::ErrorType::OutOfMemory);             \
         }                                                                                            \
         }                                                                                            \
         static_assert(!::AK::Detail::IsLvalueReference<decltype(_temporary_result.release_value())>, \
         static_assert(!::AK::Detail::IsLvalueReference<decltype(_temporary_result.release_value())>, \
             "Do not return a reference from a fallible expression");                                 \
             "Do not return a reference from a fallible expression");                                 \