ModuleSharedContext.h (1353B)
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 frontend_ModuleSharedContext_h 8 #define frontend_ModuleSharedContext_h 9 10 #include "mozilla/Assertions.h" // MOZ_ASSERT 11 #include "mozilla/Attributes.h" // MOZ_STACK_CLASS 12 13 #include "jstypes.h" 14 15 #include "frontend/SharedContext.h" // js::frontend::SharedContext 16 #include "vm/Scope.h" // js::ModuleScope 17 18 namespace JS { 19 class JS_PUBLIC_API ReadOnlyCompileOptions; 20 } 21 22 namespace js { 23 24 class ModuleBuilder; 25 struct SourceExtent; 26 27 namespace frontend { 28 29 class MOZ_STACK_CLASS ModuleSharedContext : public SuspendableContext { 30 public: 31 ModuleScope::ParserData* bindings; 32 ModuleBuilder& builder; 33 34 ModuleSharedContext(FrontendContext* fc, 35 const JS::ReadOnlyCompileOptions& options, 36 ModuleBuilder& builder, SourceExtent extent); 37 }; 38 39 inline ModuleSharedContext* SharedContext::asModuleContext() { 40 MOZ_ASSERT(isModuleContext()); 41 return static_cast<ModuleSharedContext*>(this); 42 } 43 44 } // namespace frontend 45 } // namespace js 46 47 #endif /* frontend_ModuleSharedContext_h */