summaryrefslogtreecommitdiff
path: root/Userland/DevTools/HackStudio/Debugger/DebuggerGlobalJSObject.h
blob: 348974de554b6199d11b29aea4fbea3953061477 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Weakable.h>
#include <LibDebug/DebugInfo.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/GlobalObject.h>

namespace HackStudio {

class DebuggerGlobalJSObject final
    : public JS::GlobalObject
    , public Weakable<DebuggerGlobalJSObject> {
    JS_OBJECT(DebuggerGlobalJSObject, JS::GlobalObject);

public:
    DebuggerGlobalJSObject();

    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;
    Optional<u32> js_to_debugger(JS::Value value, const Debug::DebugInfo::VariableInfo&) const;

private:
    NonnullOwnPtrVector<Debug::DebugInfo::VariableInfo> m_variables;
};

}