1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:17:35 +00:00

LibJS: Accept FlyStrings in the NativeFunction constructors

This makes the implicit run-time assertion in PropertyName::to_string()
into an explicit compile-time requirement, removes a wasteful FlyString
-> PropertyName -> FlyString construction from NativeFunction::create()
and allows setting the function name to a null string for anonymous
native functions.
This commit is contained in:
Idan Horowitz 2021-06-28 03:45:49 +03:00 committed by Linus Groh
parent 16eb0803fc
commit 581f20e6f2
24 changed files with 28 additions and 28 deletions

View file

@ -17,7 +17,7 @@ class NativeFunction : public FunctionObject {
public:
static NativeFunction* create(GlobalObject&, const FlyString& name, Function<Value(VM&, GlobalObject&)>);
explicit NativeFunction(PropertyName const& name, Function<Value(VM&, GlobalObject&)>, Object& prototype);
explicit NativeFunction(FlyString name, Function<Value(VM&, GlobalObject&)>, Object& prototype);
virtual void initialize(GlobalObject&) override { }
virtual ~NativeFunction() override;
@ -30,7 +30,7 @@ public:
virtual bool is_strict_mode() const override;
protected:
NativeFunction(PropertyName const& name, Object& prototype);
NativeFunction(FlyString name, Object& prototype);
explicit NativeFunction(Object& prototype);
private: