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/scopes.h

Issue 1024703004: Cleanups needed for this-scoping in arrow functions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Removed codegen bits and Scope::has_this_declaration() Created 5 years, 9 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/parser.cc ('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"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 class ParseInfo; 15 class ParseInfo;
16 16
17 // A hash map to support fast variable declaration and lookup. 17 // A hash map to support fast variable declaration and lookup.
18 class VariableMap: public ZoneHashMap { 18 class VariableMap: public ZoneHashMap {
19 public: 19 public:
20 explicit VariableMap(Zone* zone); 20 explicit VariableMap(Zone* zone);
21 21
22 virtual ~VariableMap(); 22 virtual ~VariableMap();
23 23
24 Variable* Declare(Scope* scope, const AstRawString* name, VariableMode mode, 24 Variable* Declare(Scope* scope, const AstRawString* name, VariableMode mode,
25 bool is_valid_lhs, Variable::Kind kind, 25 Variable::Kind kind, InitializationFlag initialization_flag,
26 InitializationFlag initialization_flag,
27 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); 26 MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
28 27
29 Variable* Lookup(const AstRawString* name); 28 Variable* Lookup(const AstRawString* name);
30 29
31 Zone* zone() const { return zone_; } 30 Zone* zone() const { return zone_; }
32 31
33 private: 32 private:
34 Zone* zone_; 33 Zone* zone_;
35 }; 34 };
36 35
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 141
143 // Create a new unresolved variable. 142 // Create a new unresolved variable.
144 VariableProxy* NewUnresolved(AstNodeFactory* factory, 143 VariableProxy* NewUnresolved(AstNodeFactory* factory,
145 const AstRawString* name, 144 const AstRawString* name,
146 int start_position = RelocInfo::kNoPosition, 145 int start_position = RelocInfo::kNoPosition,
147 int end_position = RelocInfo::kNoPosition) { 146 int end_position = RelocInfo::kNoPosition) {
148 // Note that we must not share the unresolved variables with 147 // Note that we must not share the unresolved variables with
149 // the same name because they may be removed selectively via 148 // the same name because they may be removed selectively via
150 // RemoveUnresolved(). 149 // RemoveUnresolved().
151 DCHECK(!already_resolved()); 150 DCHECK(!already_resolved());
152 VariableProxy* proxy = 151 VariableProxy* proxy = factory->NewVariableProxy(
153 factory->NewVariableProxy(name, false, start_position, end_position); 152 name, Variable::NORMAL, start_position, end_position);
154 unresolved_.Add(proxy, zone_); 153 unresolved_.Add(proxy, zone_);
155 return proxy; 154 return proxy;
156 } 155 }
157 156
158 // Remove a unresolved variable. During parsing, an unresolved variable 157 // Remove a unresolved variable. During parsing, an unresolved variable
159 // may have been added optimistically, but then only the variable name 158 // may have been added optimistically, but then only the variable name
160 // was used (typically for labels). If the variable was not declared, the 159 // was used (typically for labels). If the variable was not declared, the
161 // addition introduced a new unresolved variable which may end up being 160 // addition introduced a new unresolved variable which may end up being
162 // allocated globally as a "ghost" variable. RemoveUnresolved removes 161 // allocated globally as a "ghost" variable. RemoveUnresolved removes
163 // such a variable again if it was added; otherwise this is a no-op. 162 // such a variable again if it was added; otherwise this is a no-op.
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 726
728 AstValueFactory* ast_value_factory_; 727 AstValueFactory* ast_value_factory_;
729 Zone* zone_; 728 Zone* zone_;
730 729
731 PendingCompilationErrorHandler pending_error_handler_; 730 PendingCompilationErrorHandler pending_error_handler_;
732 }; 731 };
733 732
734 } } // namespace v8::internal 733 } } // namespace v8::internal
735 734
736 #endif // V8_SCOPES_H_ 735 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698