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/base/compiler-specific.h" | 8 #include "src/base/compiler-specific.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // `try{}catch(e){let e;}`, | 200 // `try{}catch(e){let e;}`, |
201 // which is an error even though the two 'e's are declared in different | 201 // which is an error even though the two 'e's are declared in different |
202 // scopes. | 202 // scopes. |
203 Declaration* CheckLexDeclarationsConflictingWith( | 203 Declaration* CheckLexDeclarationsConflictingWith( |
204 const ZoneList<const AstRawString*>& names); | 204 const ZoneList<const AstRawString*>& names); |
205 | 205 |
206 // --------------------------------------------------------------------------- | 206 // --------------------------------------------------------------------------- |
207 // Scope-specific info. | 207 // Scope-specific info. |
208 | 208 |
209 // Inform the scope and outer scopes that the corresponding code contains an | 209 // Inform the scope and outer scopes that the corresponding code contains an |
210 // eval call. We don't record eval calls from innner scopes in the outer most | 210 // eval call. |
211 // script scope, as we only see those when parsing eagerly. If we recorded the | |
212 // calls then, the outer most script scope would look different depending on | |
213 // whether we parsed eagerly or not which is undesirable. | |
214 void RecordEvalCall() { | 211 void RecordEvalCall() { |
215 scope_calls_eval_ = true; | 212 scope_calls_eval_ = true; |
216 inner_scope_calls_eval_ = true; | 213 inner_scope_calls_eval_ = true; |
217 for (Scope* scope = outer_scope(); scope && !scope->is_script_scope(); | 214 for (Scope* scope = outer_scope(); scope != nullptr; |
218 scope = scope->outer_scope()) { | 215 scope = scope->outer_scope()) { |
219 scope->inner_scope_calls_eval_ = true; | 216 scope->inner_scope_calls_eval_ = true; |
220 } | 217 } |
221 } | 218 } |
222 | 219 |
223 // Set the language mode flag (unless disabled by a global flag). | 220 // Set the language mode flag (unless disabled by a global flag). |
224 void SetLanguageMode(LanguageMode language_mode) { | 221 void SetLanguageMode(LanguageMode language_mode) { |
225 DCHECK(!is_module_scope() || is_strict(language_mode)); | 222 DCHECK(!is_module_scope() || is_strict(language_mode)); |
226 set_language_mode(language_mode); | 223 set_language_mode(language_mode); |
227 } | 224 } |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 void AllocateModuleVariables(); | 854 void AllocateModuleVariables(); |
858 | 855 |
859 private: | 856 private: |
860 ModuleDescriptor* module_descriptor_; | 857 ModuleDescriptor* module_descriptor_; |
861 }; | 858 }; |
862 | 859 |
863 } // namespace internal | 860 } // namespace internal |
864 } // namespace v8 | 861 } // namespace v8 |
865 | 862 |
866 #endif // V8_AST_SCOPES_H_ | 863 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |