Coverage Report

Created: 2025-12-12 07:27

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/hermes/include/hermes/VM/JSDate.h
Line
Count
Source
1
/*
2
 * Copyright (c) Meta Platforms, Inc. and affiliates.
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
8
#ifndef HERMES_VM_JSDATE_H
9
#define HERMES_VM_JSDATE_H
10
11
#include "hermes/VM/JSObject.h"
12
13
namespace hermes {
14
namespace vm {
15
16
/// Date object.
17
class JSDate final : public JSObject {
18
  using Super = JSObject;
19
  friend void JSDateBuildMeta(const GCCell *, Metadata::Builder &);
20
21
 public:
22
  static const ObjectVTable vt;
23
24
0
  static constexpr CellKind getCellKind() {
25
0
    return CellKind::JSDateKind;
26
0
  }
27
0
  static bool classof(const GCCell *cell) {
28
0
    return cell->getKind() == CellKind::JSDateKind;
29
0
  }
30
31
  static PseudoHandle<JSDate>
32
  create(Runtime &runtime, double value, Handle<JSObject> prototype);
33
34
  static PseudoHandle<JSDate> create(
35
      Runtime &runtime,
36
0
      Handle<JSObject> prototype) {
37
0
    return create(runtime, std::numeric_limits<double>::quiet_NaN(), prototype);
38
0
  }
39
40
  /// \return the [[PrimitiveValue]] internal property.
41
0
  double getPrimitiveValue() {
42
0
    return primitiveValue_;
43
0
  }
44
45
  /// Set the [[PrimitiveValue]] internal property.
46
0
  void setPrimitiveValue(double value) {
47
0
    primitiveValue_ = value;
48
0
  }
49
50
  JSDate(
51
      Runtime &runtime,
52
      double value,
53
      Handle<JSObject> parent,
54
      Handle<HiddenClass> clazz)
55
0
      : JSObject(runtime, *parent, *clazz), primitiveValue_{value} {}
56
57
 private:
58
  double primitiveValue_;
59
};
60
61
} // namespace vm
62
} // namespace hermes
63
64
#endif