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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
203 void RecordEvalCall() { | 203 void RecordEvalCall() { |
204 scope_calls_eval_ = true; | 204 scope_calls_eval_ = true; |
205 for (Scope* scope = this; scope != nullptr; scope = scope->outer_scope()) { | 205 inner_scope_calls_eval_ = true; |
| 206 for (Scope* scope = outer_scope(); scope && !scope->is_script_scope(); |
| 207 scope = scope->outer_scope()) { |
206 scope->inner_scope_calls_eval_ = true; | 208 scope->inner_scope_calls_eval_ = true; |
207 } | 209 } |
208 } | 210 } |
209 | 211 |
210 // Set the language mode flag (unless disabled by a global flag). | 212 // Set the language mode flag (unless disabled by a global flag). |
211 void SetLanguageMode(LanguageMode language_mode) { | 213 void SetLanguageMode(LanguageMode language_mode) { |
212 DCHECK(!is_module_scope() || is_strict(language_mode)); | 214 DCHECK(!is_module_scope() || is_strict(language_mode)); |
213 set_language_mode(language_mode); | 215 set_language_mode(language_mode); |
214 } | 216 } |
215 | 217 |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 void AllocateModuleVariables(); | 845 void AllocateModuleVariables(); |
844 | 846 |
845 private: | 847 private: |
846 ModuleDescriptor* module_descriptor_; | 848 ModuleDescriptor* module_descriptor_; |
847 }; | 849 }; |
848 | 850 |
849 } // namespace internal | 851 } // namespace internal |
850 } // namespace v8 | 852 } // namespace v8 |
851 | 853 |
852 #endif // V8_AST_SCOPES_H_ | 854 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |