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

Side by Side Diff: src/scopes.h

Issue 1405313002: [es6] Fix scoping for default parameters in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix class literal handling Created 5 years, 2 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
« no previous file with comments | « src/preparser.h ('k') | src/scopes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_SCOPES_H_ 5 #ifndef V8_SCOPES_H_
6 #define V8_SCOPES_H_ 6 #define V8_SCOPES_H_
7 7
8 #include "src/ast.h" 8 #include "src/ast.h"
9 #include "src/pending-compilation-error-handler.h" 9 #include "src/pending-compilation-error-handler.h"
10 #include "src/zone.h" 10 #include "src/zone.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Note that we must not share the unresolved variables with 171 // Note that we must not share the unresolved variables with
172 // the same name because they may be removed selectively via 172 // the same name because they may be removed selectively via
173 // RemoveUnresolved(). 173 // RemoveUnresolved().
174 DCHECK(!already_resolved()); 174 DCHECK(!already_resolved());
175 VariableProxy* proxy = 175 VariableProxy* proxy =
176 factory->NewVariableProxy(name, kind, start_position, end_position); 176 factory->NewVariableProxy(name, kind, start_position, end_position);
177 unresolved_.Add(proxy, zone_); 177 unresolved_.Add(proxy, zone_);
178 return proxy; 178 return proxy;
179 } 179 }
180 180
181 void AddUnresolved(VariableProxy* proxy) {
182 DCHECK(!already_resolved());
183 DCHECK(!proxy->is_resolved());
184 unresolved_.Add(proxy, zone_);
185 }
186
181 // Remove a unresolved variable. During parsing, an unresolved variable 187 // Remove a unresolved variable. During parsing, an unresolved variable
182 // may have been added optimistically, but then only the variable name 188 // may have been added optimistically, but then only the variable name
183 // was used (typically for labels). If the variable was not declared, the 189 // was used (typically for labels). If the variable was not declared, the
184 // addition introduced a new unresolved variable which may end up being 190 // addition introduced a new unresolved variable which may end up being
185 // allocated globally as a "ghost" variable. RemoveUnresolved removes 191 // allocated globally as a "ghost" variable. RemoveUnresolved removes
186 // such a variable again if it was added; otherwise this is a no-op. 192 // such a variable again if it was added; otherwise this is a no-op.
187 void RemoveUnresolved(VariableProxy* var); 193 bool RemoveUnresolved(VariableProxy* var);
188 194
189 // Creates a new temporary variable in this scope's TemporaryScope. The 195 // Creates a new temporary variable in this scope's TemporaryScope. The
190 // name is only used for printing and cannot be used to find the variable. 196 // name is only used for printing and cannot be used to find the variable.
191 // In particular, the only way to get hold of the temporary is by keeping the 197 // In particular, the only way to get hold of the temporary is by keeping the
192 // Variable* around. The name should not clash with a legitimate variable 198 // Variable* around. The name should not clash with a legitimate variable
193 // names. 199 // names.
194 Variable* NewTemporary(const AstRawString* name); 200 Variable* NewTemporary(const AstRawString* name);
195 201
196 // Adds the specific declaration node to the list of declarations in 202 // Adds the specific declaration node to the list of declarations in
197 // this scope. The declarations are processed as part of entering 203 // this scope. The declarations are processed as part of entering
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 463 }
458 464
459 // Declarations list. 465 // Declarations list.
460 ZoneList<Declaration*>* declarations() { return &decls_; } 466 ZoneList<Declaration*>* declarations() { return &decls_; }
461 467
462 // Inner scope list. 468 // Inner scope list.
463 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } 469 ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; }
464 470
465 // The scope immediately surrounding this scope, or NULL. 471 // The scope immediately surrounding this scope, or NULL.
466 Scope* outer_scope() const { return outer_scope_; } 472 Scope* outer_scope() const { return outer_scope_; }
473 void set_outer_scope(Scope* outer_scope) { outer_scope_ = outer_scope; }
467 474
468 // The ModuleDescriptor for this scope; only for module scopes. 475 // The ModuleDescriptor for this scope; only for module scopes.
469 ModuleDescriptor* module() const { return module_descriptor_; } 476 ModuleDescriptor* module() const { return module_descriptor_; }
470 477
471 478
472 void set_class_declaration_group_start(int position) { 479 void set_class_declaration_group_start(int position) {
473 class_declaration_group_start_ = position; 480 class_declaration_group_start_ = position;
474 } 481 }
475 482
476 int class_declaration_group_start() const { 483 int class_declaration_group_start() const {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 831
825 // For tracking which classes are declared consecutively. Needed for strong 832 // For tracking which classes are declared consecutively. Needed for strong
826 // mode. 833 // mode.
827 int class_declaration_group_start_; 834 int class_declaration_group_start_;
828 }; 835 };
829 836
830 } // namespace internal 837 } // namespace internal
831 } // namespace v8 838 } // namespace v8
832 839
833 #endif // V8_SCOPES_H_ 840 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/preparser.h ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698