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

Side by Side Diff: src/parsing/parameter-initializer-rewriter.cc

Issue 1564083002: Add spread rewriting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/parsing/parameter-initializer-rewriter.h" 5 #include "src/parsing/parameter-initializer-rewriter.h"
6 6
7 #include "src/ast/ast.h" 7 #include "src/ast/ast.h"
8 #include "src/ast/ast-expression-visitor.h" 8 #include "src/ast/ast-expression-visitor.h"
9 #include "src/ast/scopes.h" 9 #include "src/ast/scopes.h"
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 Visit(prop->key()); 53 Visit(prop->key());
54 } 54 }
55 // No need to visit the values, since all values are functions with 55 // No need to visit the values, since all values are functions with
56 // the class scope on their scope chain. 56 // the class scope on their scope chain.
57 DCHECK(prop->value()->IsFunctionLiteral()); 57 DCHECK(prop->value()->IsFunctionLiteral());
58 } 58 }
59 } 59 }
60 60
61 61
62 void Rewriter::VisitVariableProxy(VariableProxy* proxy) { 62 void Rewriter::VisitVariableProxy(VariableProxy* proxy) {
63 DCHECK(!proxy->is_resolved()); 63 // TODO(nikolaos): This is the point that I'm not sure whether I have
64 if (old_scope_->RemoveUnresolved(proxy)) { 64 // done the right thing (changing the scope of temporary variables).
65 if (proxy->is_resolved()) {
66 Variable* var = proxy->var();
67 DCHECK_EQ(var->mode(), TEMPORARY);
68 if (old_scope_->RemoveTemporary(var)) {
69 var->set_scope(new_scope_);
70 new_scope_->AddTemporary(var);
71 }
72 } else if (old_scope_->RemoveUnresolved(proxy)) {
65 new_scope_->AddUnresolved(proxy); 73 new_scope_->AddUnresolved(proxy);
66 } 74 }
67 } 75 }
68 76
69 77
70 } // anonymous namespace 78 } // anonymous namespace
71 79
72 80
73 void RewriteParameterInitializerScope(uintptr_t stack_limit, 81 void RewriteParameterInitializerScope(uintptr_t stack_limit,
74 Expression* initializer, Scope* old_scope, 82 Expression* initializer, Scope* old_scope,
75 Scope* new_scope) { 83 Scope* new_scope) {
76 Rewriter rewriter(stack_limit, initializer, old_scope, new_scope); 84 Rewriter rewriter(stack_limit, initializer, old_scope, new_scope);
77 rewriter.Run(); 85 rewriter.Run();
78 } 86 }
79 87
80 88
81 } // namespace internal 89 } // namespace internal
82 } // namespace v8 90 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/variables.h ('k') | src/parsing/parser.h » ('j') | src/parsing/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698