| Index: src/func-name-inferrer.h
|
| diff --git a/src/func-name-inferrer.h b/src/func-name-inferrer.h
|
| index 8bc0e6c81ee9c682489a936f99ae45d68b9a2878..c17acf52f2ec205ea2ff650e9e7540165856c426 100644
|
| --- a/src/func-name-inferrer.h
|
| +++ b/src/func-name-inferrer.h
|
| @@ -30,17 +30,29 @@ class FuncNameInferrer : public ZoneObject {
|
| public:
|
| FuncNameInferrer(AstValueFactory* ast_value_factory, Zone* zone);
|
|
|
| + // To enter function name inference state, put a FuncNameInferrer::State
|
| + // on the stack.
|
| + class State {
|
| + public:
|
| + explicit State(FuncNameInferrer* fni) : fni_(fni) {
|
| + if (fni_ != nullptr) fni_->Enter();
|
| + }
|
| + ~State() {
|
| + if (fni_ != nullptr) fni_->Leave();
|
| + }
|
| +
|
| + private:
|
| + FuncNameInferrer* fni_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(State);
|
| + };
|
| +
|
| // Returns whether we have entered name collection state.
|
| bool IsOpen() const { return !entries_stack_.is_empty(); }
|
|
|
| // Pushes an enclosing the name of enclosing function onto names stack.
|
| void PushEnclosingName(const AstRawString* name);
|
|
|
| - // Enters name collection state.
|
| - void Enter() {
|
| - entries_stack_.Add(names_stack_.length(), zone());
|
| - }
|
| -
|
| // Pushes an encountered name onto names stack when in collection state.
|
| void PushLiteralName(const AstRawString* name);
|
|
|
| @@ -67,14 +79,6 @@ class FuncNameInferrer : public ZoneObject {
|
| }
|
| }
|
|
|
| - // Leaves names collection state.
|
| - void Leave() {
|
| - DCHECK(IsOpen());
|
| - names_stack_.Rewind(entries_stack_.RemoveLast());
|
| - if (entries_stack_.is_empty())
|
| - funcs_to_infer_.Clear();
|
| - }
|
| -
|
| private:
|
| enum NameType {
|
| kEnclosingConstructorName,
|
| @@ -87,6 +91,14 @@ class FuncNameInferrer : public ZoneObject {
|
| NameType type;
|
| };
|
|
|
| + void Enter() { entries_stack_.Add(names_stack_.length(), zone()); }
|
| +
|
| + void Leave() {
|
| + DCHECK(IsOpen());
|
| + names_stack_.Rewind(entries_stack_.RemoveLast());
|
| + if (entries_stack_.is_empty()) funcs_to_infer_.Clear();
|
| + }
|
| +
|
| Zone* zone() const { return zone_; }
|
|
|
| // Constructs a full name in dotted notation from gathered names.
|
|
|