Просмотр исходного кода

LibJS: Temporarily clear exception in Object::get_without_side_effects()

This would return an empty value once it hits an exception check
otherwise. Considering that this mostly is used in situations where we
already *do* have an exception (traceback printing, for example), let's
make this easier for ourselves to use.
Linus Groh 4 лет назад
Родитель
Сommit
0cf04d07aa
1 измененных файлов с 2 добавлено и 0 удалено
  1. 2 0
      Userland/Libraries/LibJS/Runtime/Object.cpp

+ 2 - 0
Userland/Libraries/LibJS/Runtime/Object.cpp

@@ -19,6 +19,7 @@
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/Object.h>
 #include <LibJS/Runtime/Shape.h>
 #include <LibJS/Runtime/Shape.h>
 #include <LibJS/Runtime/StringObject.h>
 #include <LibJS/Runtime/StringObject.h>
+#include <LibJS/Runtime/TemporaryClearException.h>
 #include <LibJS/Runtime/Value.h>
 #include <LibJS/Runtime/Value.h>
 
 
 namespace JS {
 namespace JS {
@@ -789,6 +790,7 @@ Value Object::get(const PropertyName& property_name, Value receiver, bool withou
 
 
 Value Object::get_without_side_effects(const PropertyName& property_name) const
 Value Object::get_without_side_effects(const PropertyName& property_name) const
 {
 {
+    TemporaryClearException clear_exception(vm());
     return get(property_name, {}, true);
     return get(property_name, {}, true);
 }
 }