summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/Debugger
diff options
context:
space:
mode:
authorLinus Groh <mail@linusgroh.de>2021-09-29 18:20:10 +0100
committerLinus Groh <mail@linusgroh.de>2021-09-29 23:49:53 +0100
commit6c2b974db28a0720a8788676f3a01f7cbc668afa (patch)
tree3e4389aeb1eb56124e37526b3580a7d8498381c2 /Userland/DevTools/HackStudio/Debugger
parentd9895ec12dbf51066fdc873920803121d7499844 (diff)
downloadserenity-6c2b974db28a0720a8788676f3a01f7cbc668afa.zip
LibJS: Convert internal_get() to ThrowCompletionOr
Diffstat (limited to 'Userland/DevTools/HackStudio/Debugger')
-rw-r--r--Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp6
-rw-r--r--Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp
index 182e85befd..50d6ced836 100644
--- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp
+++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.cpp
@@ -7,6 +7,7 @@
#include "DebuggerGlobalJSObject.h"
#include "Debugger.h"
#include "DebuggerVariableJSObject.h"
+#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Object.h>
#include <LibJS/Runtime/ProxyObject.h>
@@ -21,7 +22,7 @@ DebuggerGlobalJSObject::DebuggerGlobalJSObject()
m_variables = lib->debug_info->get_variables_in_current_scope(regs);
}
-JS::Value DebuggerGlobalJSObject::internal_get(JS::PropertyName const& property_name, JS::Value receiver) const
+JS::ThrowCompletionOr<JS::Value> DebuggerGlobalJSObject::internal_get(JS::PropertyName const& property_name, JS::Value receiver) const
{
if (m_variables.is_empty() || !property_name.is_string())
return Base::internal_get(property_name, receiver);
@@ -36,8 +37,7 @@ JS::Value DebuggerGlobalJSObject::internal_get(JS::PropertyName const& property_
if (js_value.has_value())
return js_value.value();
auto error_string = String::formatted("Variable {} of type {} is not convertible to a JS Value", property_name.as_string(), target_variable.type_name);
- vm().throw_exception<JS::TypeError>(const_cast<DebuggerGlobalJSObject&>(*this), error_string);
- return {};
+ return vm().throw_completion<JS::TypeError>(const_cast<DebuggerGlobalJSObject&>(*this), move(error_string));
}
bool DebuggerGlobalJSObject::internal_set(JS::PropertyName const& property_name, JS::Value value, JS::Value receiver)
diff --git a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h
index 255fb4fca6..348974de55 100644
--- a/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h
+++ b/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h
@@ -8,6 +8,7 @@
#include <AK/Weakable.h>
#include <LibDebug/DebugInfo.h>
+#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/GlobalObject.h>
namespace HackStudio {
@@ -20,7 +21,7 @@ class DebuggerGlobalJSObject final
public:
DebuggerGlobalJSObject();
- virtual JS::Value internal_get(JS::PropertyName const&, JS::Value receiver) const override;
+ virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyName const&, JS::Value receiver) const override;
virtual bool internal_set(JS::PropertyName const&, JS::Value value, JS::Value receiver) override;
Optional<JS::Value> debugger_to_js(const Debug::DebugInfo::VariableInfo&) const;