summaryrefslogtreecommitdiff
path: root/js/src/frontend/ObjectEmitter.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/ObjectEmitter.h')
-rw-r--r--js/src/frontend/ObjectEmitter.h33
1 files changed, 17 insertions, 16 deletions
diff --git a/js/src/frontend/ObjectEmitter.h b/js/src/frontend/ObjectEmitter.h
index 247e221761..b389c3e180 100644
--- a/js/src/frontend/ObjectEmitter.h
+++ b/js/src/frontend/ObjectEmitter.h
@@ -464,6 +464,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class {}`
// ClassEmitter ce(this);
+// ce.emitScope(scopeBindings, false);
// ce.emitClass();
//
// ce.emitInitDefaultConstructor(Some(offset_of_class),
@@ -473,6 +474,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class { constructor() { ... } }`
// ClassEmitter ce(this);
+// ce.emitScope(scopeBindings, false);
// ce.emitClass();
//
// emit(function_for_constructor);
@@ -482,7 +484,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class X { constructor() { ... } }`
// ClassEmitter ce(this);
-// ce.emitScopeForNamedClass(scopeBindingForName);
+// ce.emitScope(scopeBindings, true);
// ce.emitClass(atom_of_X);
//
// ce.emitInitDefaultConstructor(Some(offset_of_class),
@@ -492,7 +494,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class X { constructor() { ... } }`
// ClassEmitter ce(this);
-// ce.emitScopeForNamedClass(scopeBindingForName);
+// ce.emitScope(scopeBindings, true);
// ce.emitClass(atom_of_X);
//
// emit(function_for_constructor);
@@ -502,7 +504,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class X extends Y { constructor() { ... } }`
// ClassEmitter ce(this);
-// ce.emitScopeForNamedClass(scopeBindingForName);
+// ce.emitScope(scopeBindings, true);
//
// emit(Y);
// ce.emitDerivedClass(atom_of_X);
@@ -514,7 +516,7 @@ class MOZ_RAII AutoSaveLocalStrictMode
//
// `class X extends Y { constructor() { ... super.f(); ... } }`
// ClassEmitter ce(this);
-// ce.emitScopeForNamedClass(scopeBindingForName);
+// ce.emitScope(scopeBindings, true);
//
// emit(Y);
// ce.emitDerivedClass(atom_of_X);
@@ -629,21 +631,21 @@ class MOZ_STACK_CLASS ClassEmitter : public PropertyEmitter
bool isDerived_ = false;
mozilla::Maybe<TDZCheckCache> tdzCacheForInnerName_;
- mozilla::Maybe<EmitterScope> innerNameScope_;
+ mozilla::Maybe<EmitterScope> innerScope_;
AutoSaveLocalStrictMode strictMode_;
#ifdef DEBUG
// The state of this emitter.
//
// +-------+
- // | Start |-+------------------------------------>+-+
- // +-------+ | ^ |
- // | [named class] | |
- // | emitScopeForNamedClass +-------+ | |
- // +-------------------------->| Scope |-+ |
- // +-------+ |
- // |
- // +-----------------------------------------------+
+ // | Start |-+------------------------>+-+
+ // +-------+ | ^ |
+ // | [has scope] | |
+ // | emitScope +-------+ | |
+ // +-------------->| Scope |-+ |
+ // +-------+ |
+ // |
+ // +-----------------------------------+
// |
// | emitClass +-------+
// +-+----------------->+->| Class |-+
@@ -669,7 +671,7 @@ class MOZ_STACK_CLASS ClassEmitter : public PropertyEmitter
// The initial state.
Start,
- // After calling emitScopeForNamedClass.
+ // After calling emitScope.
Scope,
// After calling emitClass or emitDerivedClass.
@@ -689,8 +691,7 @@ class MOZ_STACK_CLASS ClassEmitter : public PropertyEmitter
public:
explicit ClassEmitter(BytecodeEmitter* bce);
- MOZ_MUST_USE bool emitScopeForNamedClass(
- JS::Handle<LexicalScope::Data*> scopeBindings);
+ MOZ_MUST_USE bool emitScope(JS::Handle<LexicalScope::Data*> scopeBindings, bool hasName);
// @param name
// Name of the class (nullptr if this is anonymous class)