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

Side by Side Diff: src/ast/scopes.h

Issue 2318953003: Comment about why we don't record evals from inner scopes in the script scope (Closed)
Patch Set: updates Created 4 years, 3 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 | « no previous file | no next file » | 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_AST_SCOPES_H_ 5 #ifndef V8_AST_SCOPES_H_
6 #define V8_AST_SCOPES_H_ 6 #define V8_AST_SCOPES_H_
7 7
8 #include "src/ast/variables.h" 8 #include "src/ast/variables.h"
9 #include "src/base/hashmap.h" 9 #include "src/base/hashmap.h"
10 #include "src/globals.h" 10 #include "src/globals.h"
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // `try{}catch(e){let e;}`, 192 // `try{}catch(e){let e;}`,
193 // which is an error even though the two 'e's are declared in different 193 // which is an error even though the two 'e's are declared in different
194 // scopes. 194 // scopes.
195 Declaration* CheckLexDeclarationsConflictingWith( 195 Declaration* CheckLexDeclarationsConflictingWith(
196 const ZoneList<const AstRawString*>& names); 196 const ZoneList<const AstRawString*>& names);
197 197
198 // --------------------------------------------------------------------------- 198 // ---------------------------------------------------------------------------
199 // Scope-specific info. 199 // Scope-specific info.
200 200
201 // Inform the scope and outer scopes that the corresponding code contains an 201 // Inform the scope and outer scopes that the corresponding code contains an
202 // eval call. 202 // eval call. We don't record eval calls from innner scopes in the outer most
203 // script scope, as we only see those when parsing eagerly. If we recorded the
204 // calls then, the outer most script scope would look different depending on
205 // whether we parsed eagerly or not which is undesirable.
203 void RecordEvalCall() { 206 void RecordEvalCall() {
204 scope_calls_eval_ = true; 207 scope_calls_eval_ = true;
205 inner_scope_calls_eval_ = true; 208 inner_scope_calls_eval_ = true;
206 for (Scope* scope = outer_scope(); scope && !scope->is_script_scope(); 209 for (Scope* scope = outer_scope(); scope && !scope->is_script_scope();
207 scope = scope->outer_scope()) { 210 scope = scope->outer_scope()) {
208 scope->inner_scope_calls_eval_ = true; 211 scope->inner_scope_calls_eval_ = true;
209 } 212 }
210 } 213 }
211 214
212 // Set the language mode flag (unless disabled by a global flag). 215 // Set the language mode flag (unless disabled by a global flag).
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 void AllocateModuleVariables(); 853 void AllocateModuleVariables();
851 854
852 private: 855 private:
853 ModuleDescriptor* module_descriptor_; 856 ModuleDescriptor* module_descriptor_;
854 }; 857 };
855 858
856 } // namespace internal 859 } // namespace internal
857 } // namespace v8 860 } // namespace v8
858 861
859 #endif // V8_AST_SCOPES_H_ 862 #endif // V8_AST_SCOPES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698