Debian Codegraph @

js/src/shell/ShellModuleObjectWrapper.h

raw
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #ifndef shell_ShellModuleObjectWrapper_h
8 #define shell_ShellModuleObjectWrapper_h
9
10 #include "builtin/ModuleObject.h" // js::ModuleObject
11 #include "js/Class.h" // JSClass
12 #include "js/RootingAPI.h" // JS::Handle
13 #include "vm/NativeObject.h" // js::NativeObject
14
15 namespace js {
16
17 namespace shell {
18
19 // ModuleObject's accessors and methods are only for internal usage in
20 // js/src/builtin/Module.js, and they don't check arguments types.
21 //
22 // To use ModuleObject in tests, add a wrapper that checks arguments types.
23 class ShellModuleObjectWrapper : public js::NativeObject {
24 public:
25 using Target = ModuleObject;
26 enum ModuleSlot { TargetSlot = 0, SlotCount };
27 static const JSClass class_;
28 static ShellModuleObjectWrapper* create(JSContext* cx,
29 JS::Handle<ModuleObject*> moduleObj);
30 ModuleObject* get();
31 };
32
33 } // namespace shell
34 } // namespace js
35
36 #endif /* shell_ShellModuleObjectWrapper_h */