DebuggerGlobalJSObject.h 1010 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Weakable.h>
  8. #include <LibDebug/DebugInfo.h>
  9. #include <LibJS/Runtime/Completion.h>
  10. #include <LibJS/Runtime/GlobalObject.h>
  11. namespace HackStudio {
  12. class DebuggerGlobalJSObject final
  13. : public JS::GlobalObject
  14. , public Weakable<DebuggerGlobalJSObject> {
  15. JS_OBJECT(DebuggerGlobalJSObject, JS::GlobalObject);
  16. public:
  17. DebuggerGlobalJSObject();
  18. virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override;
  19. virtual JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
  20. Optional<JS::Value> debugger_to_js(Debug::DebugInfo::VariableInfo const&) const;
  21. Optional<u32> js_to_debugger(JS::Value value, Debug::DebugInfo::VariableInfo const&) const;
  22. private:
  23. NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
  24. };
  25. }