Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: src/ast/ast.h

Issue 2457393003: Thread decls-list through Declaration (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast-expression-rewriter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast.h
diff --git a/src/ast/ast.h b/src/ast/ast.h
index 81a98b641d74498d8a7c554b451a2a1c5f48325e..8ff3aa7df75e01184f248ce3fc4476958989b144 100644
--- a/src/ast/ast.h
+++ b/src/ast/ast.h
@@ -509,20 +509,25 @@ class DoExpression final : public Expression {
class Declaration : public AstNode {
public:
+ typedef ThreadedList<Declaration> List;
+
VariableProxy* proxy() const { return proxy_; }
Scope* scope() const { return scope_; }
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() { return &next_; }
+ Declaration* next_;
+ friend List;
};
@@ -2958,10 +2963,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) {
« no previous file with comments | « src/asmjs/asm-wasm-builder.cc ('k') | src/ast/ast-expression-rewriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698