OLD | NEW |
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 Loading... |
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 Loading... |
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_ |
OLD | NEW |