Bug 1592102 - Hoist ScopeKind into own header r=tcampbell
authorMatthew Gaudet <mgaudet@mozilla.com>
Fri, 06 Dec 2019 16:25:25 +0000
changeset 505848 325e83234dd53f2abdb182acc382857978c57666
parent 505847 909813da43e03f49aeec21209007fbc8c8e04a94
child 505849 351c88e680a33ea769a863b67800afedc75319fb
push id102528
push usermgaudet@mozilla.com
push dateFri, 06 Dec 2019 16:34:45 +0000
treeherderautoland@0f59860a21ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcampbell
bugs1592102
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1592102 - Hoist ScopeKind into own header r=tcampbell Avoids future circular include issues. Differential Revision: https://phabricator.services.mozilla.com/D51909
js/src/vm/Scope.h
js/src/vm/ScopeKind.h
--- a/js/src/vm/Scope.h
+++ b/js/src/vm/Scope.h
@@ -16,16 +16,17 @@
 #include "gc/DeletePolicy.h"
 #include "gc/Heap.h"
 #include "gc/Policy.h"
 #include "js/UbiNode.h"
 #include "js/UniquePtr.h"
 #include "util/Poison.h"
 #include "vm/BytecodeUtil.h"
 #include "vm/JSObject.h"
+#include "vm/ScopeKind.h"
 #include "vm/Xdr.h"
 
 namespace js {
 
 class BaseScopeData;
 class ModuleObject;
 class Scope;
 
@@ -40,53 +41,16 @@ enum class BindingKind : uint8_t {
   // throw when being assigned to in sloppy mode.
   NamedLambdaCallee
 };
 
 static inline bool BindingKindIsLexical(BindingKind kind) {
   return kind == BindingKind::Let || kind == BindingKind::Const;
 }
 
-enum class ScopeKind : uint8_t {
-  // FunctionScope
-  Function,
-
-  // VarScope
-  FunctionBodyVar,
-  ParameterExpressionVar,
-
-  // LexicalScope
-  Lexical,
-  SimpleCatch,
-  Catch,
-  NamedLambda,
-  StrictNamedLambda,
-  FunctionLexical,
-
-  // WithScope
-  With,
-
-  // EvalScope
-  Eval,
-  StrictEval,
-
-  // GlobalScope
-  Global,
-  NonSyntactic,
-
-  // ModuleScope
-  Module,
-
-  // WasmInstanceScope
-  WasmInstance,
-
-  // WasmFunctionScope
-  WasmFunction
-};
-
 enum class IsFieldInitializer : bool { No, Yes };
 
 static inline bool ScopeKindIsCatch(ScopeKind kind) {
   return kind == ScopeKind::SimpleCatch || kind == ScopeKind::Catch;
 }
 
 static inline bool ScopeKindIsInBody(ScopeKind kind) {
   return kind == ScopeKind::Lexical || kind == ScopeKind::SimpleCatch ||
new file mode 100644
--- /dev/null
+++ b/js/src/vm/ScopeKind.h
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * vim: set ts=8 sts=2 et sw=2 tw=80:
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef vm_ScopeKind_h
+#define vm_ScopeKind_h
+
+#include <stdint.h>
+
+namespace js {
+
+enum class ScopeKind : uint8_t {
+  // FunctionScope
+  Function,
+
+  // VarScope
+  FunctionBodyVar,
+  ParameterExpressionVar,
+
+  // LexicalScope
+  Lexical,
+  SimpleCatch,
+  Catch,
+  NamedLambda,
+  StrictNamedLambda,
+  FunctionLexical,
+
+  // WithScope
+  With,
+
+  // EvalScope
+  Eval,
+  StrictEval,
+
+  // GlobalScope
+  Global,
+  NonSyntactic,
+
+  // ModuleScope
+  Module,
+
+  // WasmInstanceScope
+  WasmInstance,
+
+  // WasmFunctionScope
+  WasmFunction
+};
+
+}  // namespace js
+
+#endif  // vm_ScopeKind_hs
\ No newline at end of file