Forráskód Böngészése

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 éve
szülő
commit
0cf04d07aa
1 módosított fájl, 2 hozzáadás és 0 törlés
  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/Shape.h>
 #include <LibJS/Runtime/StringObject.h>
+#include <LibJS/Runtime/TemporaryClearException.h>
 #include <LibJS/Runtime/Value.h>
 
 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
 {
+    TemporaryClearException clear_exception(vm());
     return get(property_name, {}, true);
 }