ladybird/Libraries/LibJS/Runtime/StringConstructor.h

35 lines
853 B
C
Raw Normal View History

2020-04-10 12:14:02 +00:00
/*
* Copyright (c) 2020, Andreas Kling <andreas@ladybird.org>
2020-04-10 12:14:02 +00:00
*
* SPDX-License-Identifier: BSD-2-Clause
2020-04-10 12:14:02 +00:00
*/
#pragma once
#include <LibJS/Runtime/NativeFunction.h>
namespace JS {
class StringConstructor final : public NativeFunction {
JS_OBJECT(StringConstructor, NativeFunction);
GC_DECLARE_ALLOCATOR(StringConstructor);
2020-04-10 12:14:02 +00:00
public:
virtual void initialize(Realm&) override;
virtual ~StringConstructor() override = default;
2020-04-10 12:14:02 +00:00
virtual ThrowCompletionOr<Value> call() override;
virtual ThrowCompletionOr<GC::Ref<Object>> construct(FunctionObject& new_target) override;
2020-04-10 12:14:02 +00:00
private:
explicit StringConstructor(Realm&);
2020-04-10 12:14:02 +00:00
virtual bool has_constructor() const override { return true; }
2020-05-07 00:49:48 +00:00
JS_DECLARE_NATIVE_FUNCTION(raw);
JS_DECLARE_NATIVE_FUNCTION(from_char_code);
JS_DECLARE_NATIVE_FUNCTION(from_code_point);
2020-04-10 12:14:02 +00:00
};
}