1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-23 23:05:07 +00:00
serenity/Userland/DevTools/HackStudio/Debugger/DebuggerVariableJSObject.h
Lenny Maiorani a0367aa43b DevTools+LibJS+LibWeb: Change class_name to use StringView
This helps make the overall codebase consistent. `class_name()` in
`Kernel` is always `StringView`, but not elsewhere.

Additionally, this results in the `strlen` (which needs to be done
when printing or other operations) always being computed at
compile-time.
2022-03-19 00:20:46 +00:00

38 lines
1.1 KiB
C++

/*
* Copyright (c) 2021, Matthew Olsson <matthewcolsson@gmail.com>
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
* Copyright (c) 2022, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "DebuggerGlobalJSObject.h"
#include <AK/StringView.h>
#include <LibDebug/DebugInfo.h>
#include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Object.h>
namespace HackStudio {
class DebuggerVariableJSObject final : public JS::Object {
using Base = JS::Object;
public:
static DebuggerVariableJSObject* create(DebuggerGlobalJSObject&, const Debug::DebugInfo::VariableInfo& variable_info);
DebuggerVariableJSObject(const Debug::DebugInfo::VariableInfo& variable_info, JS::Object& prototype);
virtual ~DebuggerVariableJSObject() override = default;
virtual StringView class_name() const override { return m_variable_info.type_name; }
JS::ThrowCompletionOr<bool> internal_set(JS::PropertyKey const&, JS::Value value, JS::Value receiver) override;
private:
DebuggerGlobalJSObject& debugger_object() const;
const Debug::DebugInfo::VariableInfo& m_variable_info;
};
}