1/*
2 * Copyright (C) 2021 Igalia S.L. All rights reserved.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 *
18 */
19
20#include "config.h"
21#include "TemporalObject.h"
22
23#include "JSGlobalObject.h"
24#include "ObjectPrototype.h"
25#include "TemporalNow.h"
26
27namespace JSC {
28
29STATIC_ASSERT_IS_TRIVIALLY_DESTRUCTIBLE(TemporalObject);
30
31static JSValue createNowObject(VM& vm, JSObject* object)
32{
33 TemporalObject* temporalObject = jsCast<TemporalObject*>(object);
34 JSGlobalObject* globalObject = temporalObject->globalObject(vm);
35 return TemporalNow::create(vm, TemporalNow::createStructure(vm, globalObject));
36}
37
38} // namespace JSC
39
40#include "TemporalObject.lut.h"
41
42namespace JSC {
43
44/* Source for TemporalObject.lut.h
45@begin temporalObjectTable
46 now createNowObject DontEnum|PropertyCallback
47@end
48*/
49
50const ClassInfo TemporalObject::s_info = { "Temporal", &Base::s_info, &temporalObjectTable, nullptr, CREATE_METHOD_TABLE(TemporalObject) };
51
52TemporalObject::TemporalObject(VM& vm, Structure* structure)
53 : Base(vm, structure)
54{
55}
56
57TemporalObject* TemporalObject::create(VM& vm, Structure* structure)
58{
59 TemporalObject* object = new (NotNull, allocateCell<TemporalObject>(vm.heap)) TemporalObject(vm, structure);
60 object->finishCreation(vm);
61 return object;
62}
63
64Structure* TemporalObject::createStructure(VM& vm, JSGlobalObject* globalObject)
65{
66 return Structure::create(vm, globalObject, globalObject->objectPrototype(), TypeInfo(ObjectType, StructureFlags), info());
67}
68
69void TemporalObject::finishCreation(VM& vm)
70{
71 Base::finishCreation(vm);
72 ASSERT(inherits(vm, info()));
73 JSC_TO_STRING_TAG_WITHOUT_TRANSITION();
74}
75
76} // namespace JSC