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_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" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // Checks if the block scope is redundant, i.e. it does not contain any | 110 // Checks if the block scope is redundant, i.e. it does not contain any |
111 // block scoped declarations. In that case it is removed from the scope | 111 // block scoped declarations. In that case it is removed from the scope |
112 // tree and its children are reparented. | 112 // tree and its children are reparented. |
113 Scope* FinalizeBlockScope(); | 113 Scope* FinalizeBlockScope(); |
114 | 114 |
115 // Inserts outer_scope into this scope's scope chain (and removes this | 115 // Inserts outer_scope into this scope's scope chain (and removes this |
116 // from the current outer_scope_'s inner_scopes_). | 116 // from the current outer_scope_'s inner_scopes_). |
117 // Assumes outer_scope_ is non-null. | 117 // Assumes outer_scope_ is non-null. |
118 void ReplaceOuterScope(Scope* outer_scope); | 118 void ReplaceOuterScope(Scope* outer_scope); |
119 | 119 |
120 // Propagates any eagerly-gathered scope usage flags (such as calls_eval()) | |
121 // to the passed-in scope. | |
122 void PropagateUsageFlagsToScope(Scope* other); | |
rossberg
2015/10/29 10:41:47
Nit: It would seem more natural to do this the oth
adamk
2015/10/29 14:44:59
This way felt natural enough to me, I'm inclined t
| |
123 | |
120 Zone* zone() const { return zone_; } | 124 Zone* zone() const { return zone_; } |
121 | 125 |
122 // --------------------------------------------------------------------------- | 126 // --------------------------------------------------------------------------- |
123 // Declarations | 127 // Declarations |
124 | 128 |
125 // Lookup a variable in this scope. Returns the variable or NULL if not found. | 129 // Lookup a variable in this scope. Returns the variable or NULL if not found. |
126 Variable* LookupLocal(const AstRawString* name); | 130 Variable* LookupLocal(const AstRawString* name); |
127 | 131 |
128 // This lookup corresponds to a lookup in the "intermediate" scope sitting | 132 // This lookup corresponds to a lookup in the "intermediate" scope sitting |
129 // between this scope and the outer scope. (ECMA-262, 3rd., requires that | 133 // between this scope and the outer scope. (ECMA-262, 3rd., requires that |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 // scope over a let binding of the same name. | 234 // scope over a let binding of the same name. |
231 Declaration* CheckConflictingVarDeclarations(); | 235 Declaration* CheckConflictingVarDeclarations(); |
232 | 236 |
233 // --------------------------------------------------------------------------- | 237 // --------------------------------------------------------------------------- |
234 // Scope-specific info. | 238 // Scope-specific info. |
235 | 239 |
236 // Inform the scope that the corresponding code contains a with statement. | 240 // Inform the scope that the corresponding code contains a with statement. |
237 void RecordWithStatement() { scope_contains_with_ = true; } | 241 void RecordWithStatement() { scope_contains_with_ = true; } |
238 | 242 |
239 // Inform the scope that the corresponding code contains an eval call. | 243 // Inform the scope that the corresponding code contains an eval call. |
240 void RecordEvalCall() { if (!is_script_scope()) scope_calls_eval_ = true; } | 244 void RecordEvalCall() { scope_calls_eval_ = true; } |
241 | 245 |
242 // Inform the scope that the corresponding code uses "arguments". | 246 // Inform the scope that the corresponding code uses "arguments". |
243 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } | 247 void RecordArgumentsUsage() { scope_uses_arguments_ = true; } |
244 | 248 |
245 // Inform the scope that the corresponding code uses "super". | 249 // Inform the scope that the corresponding code uses "super". |
246 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } | 250 void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } |
247 | 251 |
248 // Set the language mode flag (unless disabled by a global flag). | 252 // Set the language mode flag (unless disabled by a global flag). |
249 void SetLanguageMode(LanguageMode language_mode) { | 253 void SetLanguageMode(LanguageMode language_mode) { |
250 language_mode_ = language_mode; | 254 language_mode_ = language_mode; |
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 | 849 |
846 // For tracking which classes are declared consecutively. Needed for strong | 850 // For tracking which classes are declared consecutively. Needed for strong |
847 // mode. | 851 // mode. |
848 int class_declaration_group_start_; | 852 int class_declaration_group_start_; |
849 }; | 853 }; |
850 | 854 |
851 } // namespace internal | 855 } // namespace internal |
852 } // namespace v8 | 856 } // namespace v8 |
853 | 857 |
854 #endif // V8_SCOPES_H_ | 858 #endif // V8_SCOPES_H_ |
OLD | NEW |