Chromium Code Reviews| Index: src/ast/ast.h |
| diff --git a/src/ast/ast.h b/src/ast/ast.h |
| index 81a98b641d74498d8a7c554b451a2a1c5f48325e..a85ba49b704e8e5b74f5e5aaa9b1e47b179bd3fa 100644 |
| --- a/src/ast/ast.h |
| +++ b/src/ast/ast.h |
| @@ -509,20 +509,24 @@ class DoExpression final : public Expression { |
| class Declaration : public AstNode { |
| public: |
| + typedef ThreadedList<Declaration> List; |
| + |
| VariableProxy* proxy() const { return proxy_; } |
| Scope* scope() const { return scope_; } |
| + Declaration** next() { return &next_; } |
|
adamk
2016/10/31 20:34:23
Should this be called anywhere other than inside T
|
| protected: |
| Declaration(VariableProxy* proxy, Scope* scope, int pos, NodeType type) |
| - : AstNode(pos, type), proxy_(proxy), scope_(scope) {} |
| + : AstNode(pos, type), proxy_(proxy), scope_(scope), next_(nullptr) {} |
| static const uint8_t kNextBitFieldIndex = AstNode::kNextBitFieldIndex; |
| private: |
| VariableProxy* proxy_; |
| - |
| // Nested scope from which the declaration originated. |
| Scope* scope_; |
| + // Declarations list threaded through the declarations. |
| + Declaration* next_; |
| }; |
| @@ -2958,10 +2962,8 @@ class AstVisitor BASE_EMBEDDED { |
| public: |
| void Visit(AstNode* node) { impl()->Visit(node); } |
| - void VisitDeclarations(ZoneList<Declaration*>* declarations) { |
| - for (int i = 0; i < declarations->length(); i++) { |
| - Visit(declarations->at(i)); |
| - } |
| + void VisitDeclarations(Declaration::List* declarations) { |
| + for (Declaration* decl : *declarations) Visit(decl); |
| } |
| void VisitStatements(ZoneList<Statement*>* statements) { |