Chromium Code Reviews| Index: src/parsing/parser-base.h |
| diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h |
| index d7d6b5b16268fc40e39bb6569529fec871bf5e83..367cca0442f2dcb1573bba9a20c9c5f864dba0bb 100644 |
| --- a/src/parsing/parser-base.h |
| +++ b/src/parsing/parser-base.h |
| @@ -281,6 +281,7 @@ class ParserBase : public Traits { |
| class ScopeState BASE_EMBEDDED { |
| public: |
| V8_INLINE Scope* scope() const { return scope_; } |
| + Zone* zone() const { return scope_->zone(); } |
| protected: |
| ScopeState(ScopeState** scope_stack, Scope* scope) |
| @@ -289,11 +290,9 @@ class ParserBase : public Traits { |
| } |
| ~ScopeState() { *scope_stack_ = outer_scope_; } |
| - Zone* zone() const { return scope_->zone(); } |
| - |
| private: |
| - ScopeState** scope_stack_; |
| - ScopeState* outer_scope_; |
| + ScopeState** const scope_stack_; |
| + ScopeState* const outer_scope_; |
| Scope* scope_; |
| }; |
| @@ -301,6 +300,27 @@ class ParserBase : public Traits { |
| public: |
| BlockState(ScopeState** scope_stack, Scope* scope) |
| : ScopeState(scope_stack, scope) {} |
| + |
| + explicit BlockState(ScopeState** scope_stack) |
| + : ScopeState(scope_stack, NewScope(*scope_stack)) {} |
| + |
| + void SetNonlinear() { this->scope()->SetNonlinear(); } |
|
adamk
2016/07/21 17:48:05
These "this->" prefixes shouldn't needed here and
Toon Verwaest
2016/07/22 11:02:53
They are because the outer class is a templatized
|
| + void set_start_position(int pos) { this->scope()->set_start_position(pos); } |
| + void set_end_position(int pos) { this->scope()->set_end_position(pos); } |
| + void set_is_hidden() { this->scope()->set_is_hidden(); } |
| + Scope* FinalizedBlockScope() const { |
| + return this->scope()->FinalizeBlockScope(); |
| + } |
| + LanguageMode language_mode() const { |
| + return this->scope()->language_mode(); |
| + } |
| + |
| + private: |
| + Scope* NewScope(ScopeState* state) { |
|
adamk
2016/07/21 17:48:05
outer_state or parent_state would be clearer here
Toon Verwaest
2016/07/22 11:02:53
Done.
|
| + Scope* parent = state->scope(); |
| + Zone* zone = state->zone(); |
| + return new (zone) Scope(zone, parent, BLOCK_SCOPE, kNormalFunction); |
| + } |
| }; |
| struct DestructuringAssignment { |