mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:57:46 +00:00
LibJS: De-duplicate ClassFieldDefinition Records
This was defined twice, despite being the very same thing: - ClassElement::ClassFieldDefinition - ECMAScriptFunctionObject::InstanceField Move the former to a new header and use it everywhere. Also update the define_field() AO to take a single field instead of separate name and initializer arguments.
This commit is contained in:
parent
7a02d33cd5
commit
e815d3f9ce
9 changed files with 66 additions and 41 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <LibJS/Bytecode/CodeGenerationError.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Runtime/ClassFieldDefinition.h>
|
||||
#include <LibJS/Runtime/Completion.h>
|
||||
#include <LibJS/Runtime/EnvironmentCoordinate.h>
|
||||
#include <LibJS/Runtime/FunctionKind.h>
|
||||
|
@ -1248,13 +1249,6 @@ public:
|
|||
virtual ElementKind class_element_kind() const = 0;
|
||||
bool is_static() const { return m_is_static; }
|
||||
|
||||
using ClassElementName = Variant<PropertyKey, PrivateName>;
|
||||
|
||||
struct ClassFieldDefinition {
|
||||
ClassElementName name;
|
||||
Handle<ECMAScriptFunctionObject> initializer;
|
||||
};
|
||||
|
||||
// We use the Completion also as a ClassStaticBlockDefinition Record.
|
||||
using ClassValue = Variant<ClassFieldDefinition, Completion, PrivateElement>;
|
||||
virtual ThrowCompletionOr<ClassValue> class_element_evaluation(Interpreter&, GlobalObject&, Object& home_object) const = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue